//Prepare list
List myList = new List();
myList.Add("aString");
myList.Add("anotherstring");
//Get comma separated string
var stringBuilder = myList.Aggregate(new StringBuilder(), (builder, stringValue) =>
builder.AppendFormat((builder.Length == 0) ? "{0}" : ", {0}", stringValue));
string commaString = stringBuilder.ToString();
No comments:
Post a Comment