var names = dbcontext.EmployeeTable.Select(x => x.Name).ToList();
@foreach(e in names) { //i need to separate the names by a comma i.e // john, jen, glen }
string nameList = string.Join(", ", names);
public string AllNamesSeparatedByComma(List<string> names) { StringBuilder allNames = new StringBuilder(); foreach(string e in names) { allNames.AppendFormat("{0},", e); } return allNames.ToString(); }
string nameList = names.Aggregate((a, b) => a + ", " + b);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)