Federico
8
Q:

c# list to string

List<string> names = new List<string>() { "John", "Anna", "Monica" };
string result = string.Join(",", names.ToArray());
5
string combindedString = string.Join( ",", myList.ToArray() );
2
using System.Linq;
string str = list.Aggregate((x, y) => x + ',' + y);
0
string[] lines = { "First line", "Second line", "Third line" };
System.IO.File.WriteAllLines(@"C:\Users\Public\TestFolder\WriteLines.txt", lines);
lines = { "Fourth line", "Fith line" };
System.IO.File.AppendAllLines(@"C:\Users\Public\TestFolder\WriteLines.txt", lines);
0

New to Communities?

Join the community