Hello all,
I am wondering if there is an easy and clean way (one line) to transform an enumeration of long (IEnumerable) to a single string (string) with LINQ?
Thanks
Hello all,
I am wondering if there is an easy and clean way (one line) to transform an enumeration of long (IEnumerable) to a single string (string) with LINQ?
Thanks
If you want the long (integers?) to be comma separated try:
string str = string.Join(", ", myLongs.Select(l => l.ToString()).ToArray());
Sounds like a job for aggregate/fold:
var longs = new long[] {3, 2, 1, 0};
var str = longs.Aggregate("", (s, l) => s + l);
// str = "3210"
Although I am not quite sure what the question is.