I’m trying to create a string from the values in a list; what I am trying to achieve is the SQL syntax which is used in an update query:
UPDATE TABLE SET COLUMN1 =X WHERE COLUMN2 IN ('A','B','C')
(A,B,C are items in my list.) How can I achieve this?
I tried:
string commaSeparatedList = _list.Aggregate((a, x) => a + ", " + x);
but it creates the list without the apostrophes.
If your code gives you exactly what you want except for the apostrophes, just stick a
between
_list.and.Aggregate...