Reputation: 5136
I had a list of strings
var li = new List<string>()
{
"word1", "word2", "word3", "word4", "word5", "word6",
};
I want to concatinate some some character in each word output list will be will be
word1#,word2#,word3#,word4#,word5#,word6#
Upvotes: 1
Views: 80
Reputation: 23087
Try this
var word = string.Join("#,",li)+"#";
It will join your strings separated with #,
Upvotes: 1
Reputation: 117047
How about doing this:
li = li.Select(x => x + "#").ToList();
If you mean you want to output the string "word1#,word2#,word3#,word4#,word5#,word6#", then, after the above line, do this:
var output = String.Join(",", li);
Upvotes: 4