List<int> 转 string :

list<int>: 1,2,3,4,5,6,7  转换成字符串:“1,2,3,4,5,6,7”

List<int> list= new List<int>() { 1, 2, 3, 4, 5, 6, 7 };
string depaid = string.Join(",", list);

string  List<int>:

string s = "1, 2, 3";
List<string> list = new List<string>(s.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries));
List<string> list = new List<string>(s.Split(','));//或者

 List<string> 转 List<int>

var listOfStrings =(new[]{"4","5","6"}).ToList();
var listOfInts = listOfStrings.Select<string,int>(q =>Convert.ToInt32(q));

List<int> 转List<string> 

List<int> l1 = new List<int>(new int[] { 1,2,3 } );
List<string> l2 = l1.ConvertAll<string>(x => x.ToString());

C#中string[]数组和list<string>:

System.String[] str={"str","string","abc"};
List<System.String> listS=new List<System.String>(str);

从List<System.String>转到System.String[]

List<System.String> listS=new List<System.String>();
listS.Add("str");
listS.Add("hello");
System.String[] str=listS.ToArray();

c# List<int> 转 string 以及 string [] 转 List<int>的更多相关文章

  1. C#学习笔记-输入数据判断(int、double、string)

    代码: using System; using System.Windows.Forms; namespace CheckInput { public partial class Form1 : Fo ...

  2. C#,int转成string,string转成int

    转载:http://www.cnblogs.com/xshy3412/archive/2007/08/29/874362.html 1,int转成string用toString 或者Convert.t ...

  3. [C#]List<int>转string[],string[]转为string

    // List<int>转string[] public string[] ListInt2StringArray(List<int> input) { return Arra ...

  4. 【java基础学习一】int[]、Integer[]、String[] 排序( 正序、倒叙)、去重

    调用: //重复项有9.5.1.2 int[] ints = new int[]{9,4,7,8,2,5,1,6,2,5,9,1}; arrayIntTest(ints); ///////////// ...

  5. C++ 中int,char,string,CString类型转换

      1. c++中string到int的转换 1) 在C标准库里面,使用atoi: #include <cstdlib> #include <string> std::stri ...

  6. 首先,定义描述学生的类——Student,包括学号(int)、 姓名(String)、年龄(int)等属性;二个方法:Student(int stuNo,String name,int age) 用于对对象的初始化,outPut()用于输出学生信息。其次,再定义一个主类—— TestClass,在主类的main方法中创建多个Student类的对象,使用这些对象来测 试Student类的功能。

    package lianxi; public class Student { String Name; int XveHao,Age; Student(String Name,int XveHao,i ...

  7. C字符串和C++中string的区别 &&&&C++中int型与string型互相转换

    在C++中则把字符串封装成了一种数据类型string,可以直接声明变量并进行赋值等字符串操作.以下是C字符串和C++中string的区别:   C字符串 string对象(C++) 所需的头文件名称 ...

  8. C++11中int,float,double与string的转化

    在C++11中可以使用std::to_string()函数将数值转换为string格式,十分方便. 以下部分来选自cplusplus.com. std::to_string string to_str ...

  9. 【转】java中byte, int的转换, byte String转换

    原文网址:http://freewind886.blog.163.com/blog/static/661924642011810236100/ 最近在做些与编解码相关的事情,又遇到了byte和int的 ...

随机推荐

  1. HTTP请求报文与响应报文

    http://docs.telerik.com/fiddler/KnowledgeBase/HTTP HTTP请求报文与响应报文 HTTP http://www.w3.org/Protocols/rf ...

  2. lintcode :数组剔除元素后的乘积

    题目: 数组剔除元素后的乘积 给定一个整数数组A. 定义B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], 计算B的时候请不要使用除法. 样例 给出 ...

  3. lintcode:合并两个排序链表

    题目: 合并两个排序链表 将两个排序链表合并为一个新的排序链表  样例 给出 1->3->8->11->15->null,2->null, 返回 1->2-& ...

  4. python 解析 xml

    <taskList nextId="62292"> <task module="reliability" owner="vprovo ...

  5. utf-8中的汉字占用多少字节

    转载:http://blog.csdn.net/chummyhe89/article/details/7777613 占2个字节的:〇 占3个字节的:基本等同于GBK,含21000多个汉字 占4个字节 ...

  6. 47. Permutations II

    题目: Given a collection of numbers that might contain duplicates, return all possible unique permutat ...

  7. 盘点PHP编程常见失误

    概述:本文盘点PHP开发者在编码时,容易忽略或不注意引起的小失误与错误. 变量声明 如果在一条语句中声明一个变量,如下所示:$var='value';编译器首先会求出语句右半部分的值,恰恰正是语句的这 ...

  8. 常用的coco2d-x游戏开发工具(转)

    物理编辑工具Physics Editing ToolsMekanimo 网址:http://www.mekanimo.net/PhysicsBench 网址:http://www.cocos2d-ip ...

  9. TCP-心跳

    心跳包就是在客户端和服务器间定时通知对方自己状态的一个自己定义的命令字,按照一定的时间间隔发送,类似于心跳,所以叫做心跳包.   用来判断对方(设备,进程或其它网元)是否正常运行,采用定时发送简单的通 ...

  10. IOS地图及定位使用

    1.定位 定位使用CoreLocation库,引入CoreLocation/CoreLocation.创建CLLocationManager对象,使用startUpdatingLocation方法开始 ...