The following is our array −
double[] myArr = {20.5, 35.6, 45.7, 55.6, 79.7};To get the first element, use the First() method.
myArr.AsQueryable().First();
Let us see the complete code −
Example
using System;
using System.Linq;
using System.Collections.Generic;
class Demo {
static void Main() {
double[] myArr = {20.5, 35.6, 45.7, 55.6, 79.7};
double res = myArr.AsQueryable().First();
Console.WriteLine(res);
}
}Output
20.5