So you have a list of enum values and you need to convert it to a single string separated by some character.
To demonstrate this we need an enumerated type:
public enum test{
No,
Yes,
Maybe,
}
and a list of enum values:
var n = new List(); n.Add(test.Yes); n.Add(test.Maybe);
To get the character delimited string we need to convert the list to an array, add a bit of Linq, and use string.Join to finally concatenate the values:
string.Join(" - ", n.Select(s => s.ToString()).ToArray())
The first parameter passed to the Join method is the separator between each list item.
Voila!

You must be logged in to post a comment.