I have a List:
List<int> list = new List<int> {1, 2, 3, 4, 5};
If want to get string presentation of my List. But code list.ToString()
return "System.Collections.Generic.List'1[System.Int32]"
I am looking for standard method like this:
string str = list.Aggregate("[",
(aggregate, value) =>
aggregate.Length == 1 ?
aggregate + value : aggregate + ", " + value,
aggregate => aggregate + "]");
and get "[1, 2, 3, 4, 5]"
Is there standard .NET-method for presentation ICollection in good string format?