C#-将List里的集合转换成字符串并按指定的字符进行分隔?

代码:

using System;
using System.Collections.Generic;
publicclassMyClass{
    public static void Main(){
        List<string> names =newList<string>(){"ccc","xxx","aaa","bbbb"};
        names.Sort();
        var result =String.Join(",", names.ToArray());
        Console.Write(result);
        Console.ReadKey();
    }
}

 

 

posted @ 2019-06-23 18:21  grj001  阅读(433)  评论(0编辑  收藏  举报