Check out example codes for "c# check if element is last in list". It will help you in understanding the concepts better.

Code Example 1

foreach (var x in things)
	{
        //Do stuff
    	if (x == things.Last()) // Do Stuff only for the last item 
 	}

Code Example 2

int iteration=0;
foreach (var item in items)
  {
    iteration++;
    if (iteration < items.Count)
       {
        //do stuff  
       }              
   }

Learn ReactJs, React Native from akashmittal.com