User1535942433 posted
Hi Ssaisree,
As far as I think,if you need only one iteration,you're not necessary to use foreach. If you need to get the first item,you could use group.Just like this:
@{
var result = Model.GroupBy(x=>x.Name);
}
@foeach(var item in result)
{
<span>@item.Key</span>
}
Best regards,
Yijing Sun