METHOD

Enumerable.Take

Returns up to count leading elements. A nonpositive count gives an empty sequence. This does not make every upstream operator streaming.

Formal Syntax & Structure

csharp syntaxcsharp
source.Take(count)

Working Example

Example Snippetcsharp
using System;using System.Collections.Generic;using System.Linq;Console.WriteLine(string.Join(",", new[] { 8, 6, 4 }.Take(2))); // 8,6
C# & .NET Reference