I have a foreach loop and need to execute some logic when the last item is chosen from the List, e.g.:
foreach
List
foreach (Item result in Mod
We can check last item in loop.
foreach (Item result in Model.Results) { if (result==Model.Results.Last()) { // do something different with the last item } }