I know I could figure a way out but I am wondering if there is a more concise solution. There's always String.Join(", ", lList)
and lList.Aggregate((a, b) => a + ", " + b);
but I want to add an exception for the last one to have ", and "
as its joining string. Does Aggregate()
have some index value somewhere I can use? Thanks.
C# String Manipulation – Joining List with Commas and ‘and’ for the Last Element
c++list
Best Answer
You could do this