Please help on converting a list of objects got from DB into substrings separated by a comma
Take for example I have a sample code below:
List<string> CategoryNames = new List<string>(); CategoryNames.Add("myName1"); CategoryNames.Add("myName2"); CategoryNames.Add("myName3"); I want to convert CategoryNames into a format like this
"myName1","myName2","myName3"
From the above CatgoryNames happen to be retrieved from db.
var categoryNames = _context.BillingCategory.ToList(); How do I convert the categoryNames into substrings as shown above? Any help will be appreciated.
"myName1,myName2,myName3"?string.Joinseems like an answer.... but please clarify requirements