I have the following razor template html, although I can’t figure out how to include a comma to separate the names within the markup!? When trying the following code I get ; expected as a compiler error!. I’ll also need to remove the last comma as well.
@foreach (People person in Model.People)
{
person.Name,
}
I want: Ted, James, Jenny, Tom
What about string.Join instead of
foreach(it even solves the comma after the last item problem):