I have this line in my view
@(Html.DisplayFor(m => m.DaysOfWeek, \"_CourseTableDayOfWeek\"))
where m.DaysOfWeek is a
It's not looping because you have specified a name for the display template as second argument of the DisplayFor helper (_CourseTableDayOfWeek).
It loops only when you rely on conventions i.e.
@Html.DisplayFor(m => m.DaysOfWeek)
and then inside ~/Views/Shared/DisplayTemplates/DateTime.cshtml:
@model DateTime
@{
ViewBag.Title = "CourseTableDayOfWeek";
}
@System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DayNames[(int) Model.DayOfWeek]
Model.ToString("G")
Once you specify a custom name for the display template (either as second argument of the DisplayFor helper or as [UIHint] attribute) it will no longer loop for collection properties and the template will simply be passed the IEnumerable as model.
It's confusing but that's how it is. I don't like it either.