码迷,mamicode.com
首页 > Windows程序 > 详细

C# List<string>和ArrayList用指定的分隔符分隔成字符串

时间:2018-05-06 14:50:48      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:ring   logs   type   字符串数组   分隔符   arraylist   list   nbsp   add   

 

原文地址:https://www.cnblogs.com/ahwwmb/p/4166707.html

串联字符串数组的所有元素,其中在每个元素之间使用指定的分隔符

 

            List<string> arr = new List<string>();
            arr.Add("好玩1");
            arr.Add("好玩1");
            arr.Add("好玩1");
            string str = string.Join(",", arr.ToArray());

            ArrayList arr1 = new ArrayList();
            arr1.Add("好玩1");
            arr1.Add("好玩2");
            arr1.Add("好玩3");
            string str1 = string.Join(",", arr1.ToArray(typeof(string)) as string[]);

  

C# List<string>和ArrayList用指定的分隔符分隔成字符串

标签:ring   logs   type   字符串数组   分隔符   arraylist   list   nbsp   add   

原文地址:https://www.cnblogs.com/lijuanfei/p/8997882.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!