C # How to convert List in the collection to a string and press the specified character separated?

How to convert C #, List <string> in the set to a string and press the specified character separated?

Code:

Copy the code

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

Copy the code

 

Effect: http://ideone.com/eTQ99L

 

 

reference:

My C # and the code online editor

C# List<string> to string with delimiter

 

Guess you like

Origin blog.csdn.net/cxu123321/article/details/93395164