Input: IEnumerable 
Optional lambda expression: TSource => bool 
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class Program
{
 static void Main()
 {
 int[] numbers = { 1, 2, 3, 4, 5 };
 int last = numbers.Last(); // 5
 int lastEven = numbers.Last(n => n % 2 == 0); // 4
 Console.WriteLine(last);
 Console.WriteLine(lastEven);
 }
}
The output:
5
4