How to convert C #, List <string> in the set to a string and press the specified character separated?
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(); } }
Effect: http://ideone.com/eTQ99L
reference:
My C # and the code online editor
C# List<string> to string with delimiter