I want to add a comma after each language.Language.NativeName Right now they all just come out in one straight line. I cant just add a comma in the NativeName get method because i will use it for other stuff aswell.
<td class=" ">@Html.DisplayFor(modelItem => item.Email)</td>
<td class=" ">@Html.DisplayFor(modelItem => item.Country.Name)</td>
<td class=" ">@Html.DisplayFor(modelItem => item.City)</td>
<td class=" ">
@foreach (UserLanguage language in item.Languages)
{
@Html.DisplayFor(modelItem => language.Language.NativeName)
}
</td>
<td class=" ">Danish, English, Spanish</td>
Use string.Join:
<td class=" ">@String.Join(", ", item.Languages.Select(p => p.Language.NativeName).ToArray())</td>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With