I really like Last() and would use it all the time for Lists. But since it seems to be defined for IEnumerable, I gu
You can just use Last with List without worrying :)
Enumerable.Last attempts to downcast the IEnumerable instance to IList . If this is possible, it uses the indexer and Count property.
Here is part of the implementation as Reflector sees it:
IList list = source as IList;
if (list != null)
{
int count = list.Count;
if (count > 0)
{
return list[count - 1];
}
}