c# get last element of list code example
Example 1: c# get the last item in a list
var lastItem = integerList.Last();
Example 2: get last element in a list vb.net
if(integerList.Count>0)
{
var item = integerList[integerList.Count - 1];
}
var lastItem = integerList.Last();
if(integerList.Count>0)
{
var item = integerList[integerList.Count - 1];
}