Convert `List` to comma-separated string

前端 未结 6 1730
梦毁少年i
梦毁少年i 2020-12-09 00:33

Is there a fast way to convert List to a comma-separated string in C#?

I do it like this but Maybe there is a faster or more

6条回答
  •  悲&欢浪女
    2020-12-09 01:18

    Follow this:

           List name = new List();   
    
            name.Add("Latif");
    
            name.Add("Ram");
    
            name.Add("Adam");
            string nameOfString = (string.Join(",", name.Select(x => x.ToString()).ToArray()));
    

提交回复
热议问题