Linq

how to take in Linq c#?

how to take in Linq c#?, someone asked me to explain?

This sample uses Take to get only the first 3 elements of the array.

public void Linqtake() 
{
int[] numbers = { 1, 3, 9, 8, 6, 7, 2, 0 };
var first3Numbers = numbers.Take(3);
Console.WriteLine("First 3 numbers:");
foreach (var n in first3Numbers)
{
Console.WriteLine(n);
}
}
Result
First 3 numbers:
1
3
9

Post your comments / questions