Language Integrated Query (LINQ) is a Microsoft .NET Framework component and the uniform query syntax in C#. It has a set of method names and extends the language with query expressions.
For LINQ in C#, use −
using System.Linq;
Let us see an example. Here we have used the LINQ computational methods Count and Average to find the count of elements and average of those elements in C# −
Example
using System;
using System.Linq;
class Demo {
static void Main() {
int[] arr = { 87, 92, 45, 65, 34, 88 };
Console.WriteLine(arr.Average());
Console.WriteLine(arr.Count());
}
}output
68.5 6