I'm trying to convert an IEnumerable<int> to a string in the format #,#,#,... I'm having a terrible time attempting to make a method of this. What is a quick and easy way to handle?
Thanks.
I'm trying to convert an IEnumerable<int> to a string in the format #,#,#,... I'm having a terrible time attempting to make a method of this. What is a quick and easy way to handle?
Thanks.
Use String.Join:
string result = string.Join(",", enumerable);
Are you talking about something like:
string.Join(",", e.Select(i=>i.ToString()).ToArray());
i.e., concatenating an enumerable of ints (e in this case)?