string[] input = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
int[] output = Array.ConvertAll<string, int>(input, delegate(string s) { return int.Parse(s); });

注:

使用Array类中的静态泛形式方法ConvertAll进行转换

delegate(string s) { return int.Parse(s); }这句表示:建立一个匿名委托,该委托关联的方法体是:return int.Parse(s); 将数组中的每个字符串强制转换成整形并返回添加给 output

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/sy9301/archive/2010/04/27/5532928.aspx

[转]c#中从string数组转换到int数组的更多相关文章

  1. C# 之 将string数组转换到int数组并获取最大最小值

    1.string 数组转换到 int 数组 " }; int[] output = Array.ConvertAll<string, int>(input, delegate(s ...

  2. c#中从string数组转换到int数组

    以前一直有一个数组之间转换的东西,可是忘记了,今天也是找了好久也没有解决,最后用这种方法解决了,分享给大家. " }; int[] output = Array.ConvertAll< ...

  3. c#中从string数组转换到int数组及比较两个字符串相等

    string[] input = { "1", "2", "3", "4", "5", " ...

  4. C#string数组转换到int数组并得到最大最小值

    string[] input = { "1", "2", "3", "4", "5", " ...

  5. strin 数组转换成int 数组

    string[] strarry = ids.Trim(',').Split(','); int[] arryInts = Array.ConvertAll<string, int>(st ...

  6. 把int类型值转换成int数组(不通过string类型转换)

    只适合初学者 今天同事问了我不通过string类型把int类型值123589转换成int[]数组.我想了想于是写了出来,其实不难.看你小学数学学得好不好.言归正传. 先不说代码,举个列子就知道怎么玩了 ...

  7. 字符串集合或字符串数组转换成json数组

    字符串可以是List<String>类型的字符串集合,也可以是String[]类型的字符串数组,二者转换成JSON数组的方式没有什么不同.下面代码注意关键的部分即可(画红线部分). 1. ...

  8. 如何将PHP对象数组转换成普通数组

    /** * 对象数组转为普通数组 * * AJAX提交到后台的JSON字串经decode解码后为一个对象数组, * 为此必须转为普通数组后才能进行后续处理, * 此函数支持多维数组处理. * * @p ...

  9. 批量删除以及将String数组转换成Integer数组的奇淫技巧

    首先在pom.xml文件添加依赖: <!-- bean工具 --> <dependency> <groupId>commons-beanutils</grou ...

随机推荐

  1. 使用 ObjectDataSource 缓存数据

    简介 就计算机科学而言 , 缓存 过程包括成本昂贵的数据或信息的获取 , 以及将备份存储在可快速访问的位置.对于数据驱动的应用程序,大型.复杂的查询通常会消耗大量应用程序执行时间.要提升这类应用程序的 ...

  2. placehoder修改

    <textarea class="layui-input description" name="description" lay-verify=" ...

  3. wireshark抓包常见提示含义解析

    原文转自:http://blog.sina.com.cn/s/blog_987e00020102wq60.html http://www.cnblogs.com/redsmith/p/5462547. ...

  4. UI-7-UIScrollView

    #import "ViewController.h" @interface ViewController ()<UIScrollViewDelegate> { UIIm ...

  5. FreeBSD编译安装emacs,不要用ports

    1. 解压emacs 2. 进入解压之后的目录,执行configure命令,大体配置如下: ./configure --with-x-toolkit=no --with-xpm=no --with-j ...

  6. Tree UVA - 548 已知中序遍历和后序遍历,求这颗二叉树。

    You are to determine the value of the leaf node in a given binary tree that is the terminal node of ...

  7. Linux快速计算MD5和Sha1命令

    Linux计算MD5和Sha1的命令 MD5 MD5即Message-Digest Algorithm 5(信息-摘要算法 5),用于确保信息传输完整一致.是计算机广泛使用的杂凑算法之一(又译摘要算法 ...

  8. neocomplcache 自动补全

    key description ctrl+n 当前词补全项,下一个 ctrl+p 当前词补全项,上一个 :help NERDTree NERDTree帮助手册

  9. Python Numpy ValueError: data type must provide an itemsize

    天朝网络锁国,百度找了半个小时找不出来原因,只能谷歌 谷歌第一条就是,顿时感觉幸福感来的太突然 原因是输入的矩阵均是字符串(从文件里读的) 那么就需要批量转数组,一行一行的转. 下面是我的代码: ro ...

  10. iOS cocos2d 2游戏开发实战(第3版)书评

    2013是游戏爆发的一年,手游用户也是飞速暴增.虽然自己不做游戏,但也是时刻了解手机应用开发的新动向.看到CSDN的"写书评得技术图书赢下载分"活动,就申请了一本<iOS c ...