get last element c# .net code example
Example 1: get lastElement C# .net
int[] numbers = { 9, 34, 65, 92, 87, 435, 3, 54,
83, 23, 87, 67, 12, 19 };
int last = numbers.Last(num => num > 80);
Console.WriteLine(last);
/*
This code produces the following output:
87
*/
Example 2: get lastElement C# .net
int[] numbers = { 9, 34, 65, 92, 87, 435, 3, 54,
83, 23, 87, 67, 12, 19 };
int last = numbers.Last();
Console.WriteLine(last);
/*
This code produces the following output:
19
*/