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

原文地址: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[]);

  

猜你喜欢

转载自www.cnblogs.com/lijuanfei/p/8997882.html