The accepted answer is correct, but I prefer:
@{int count = 0;}
@foreach (var item in Model.Resources)
{
@Html.Raw(count <= 3 ? "" : "")
// some code
@Html.Raw(count <= 3 ? "
" : "")
@(count++)
}
I hope this inspires someone, even though I'm late to the party.