I've created an application in console and a foreach to scroll through my list of integers:
var lista = new List<int>() { 2, 6, 1, 4, 20, 21};
int count = 0;
foreach (var item in lista)
{
count++;
//if(???)
//count = 0;
//....
}
Console.ReadKey();
How do I know if my foreach is in the last item on my list?
Well, if it's going through the last element, inside the if will zero my count variable.