I have an IEnumerable
I wouldn't really recommend it, but I guess you could do something like this...
object m_item = notPartOfListFlag = new object();
foreach(var item in enumerator){
if(m_item != notPartOfListFlag)
{
//do stuff to m_item;
}
m_item = item;
}
//do stuff to last item aka m_item;
But I would try to use some kind of collection that exposes the position of the items in the list, then use
if(collection.IndexOf(item) == collection.Count-1) do stuff