How to convert List<string> into String of Comma Separated Quotes from List
c#
Solution
LINQ's `Select()` extension method allows to convert each item in a collection:
string variants_str = String.Join(",", variants.Select(s => "'" + s + "'"));
Demo: https://dotnetfiddle.net/I37xr6
Problem
I am trying to convert a list of strings into a comma separated with quotes variable,I can only join them as comma separated but can't put quotes around each of the entries in the list..can anyone provide guidance on how to fix it? INPUT: ``` variants = [ "CI_ABC1234.LA.0.1-03391-STD.INT-32", "CI_ABC1234.LA.0.1-33103-STD.INT-32" ] ``` EXPECTED OUTPUT: ``` ('CI_ABC1234.LA.0.1-03391-STD.INT-32','CI_ABC1234.LA.0.1-33103-STD.INT-32') ``` CODE:- ``` string variants_str = String.Join(",", variants); ```