.NET Framework Take

Download .NET Framework for free

Example

This method takes the first n elements from an enumerable.

var numbers = new[] {1,2,3,4,5};

var threeFirstNumbers = numbers.Take(3);
Console.WriteLine(string.Join(",", threeFirstNumbers.ToArray()));

//1,2,3
TakeWhile