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
What about little simpler approach.
Item last = null; foreach (Item result in Model.Results) { // do something with each item last = result; } //Here Item 'last' contains the last object that came in the last of foreach loop. DoSomethingOnLastElement(last);