Use the First() method to get the first element from an array.
Firstly, set an array.
int[] arr = {20, 40, 60, 80 , 100};Now, use the Queryable First() method to return the first element.
arr.AsQueryable().First();
The following is the entire example.
Example
using System;
using System.Linq;
using System.Collections.Generic;
class Program {
static void Main() {
int[] arr = {20, 40, 60, 80 , 100};
// getting the first element
int res = arr.AsQueryable().First();
Console.WriteLine(res);
}
}Output
20