Take method : Take « LINQ « C# / CSharp Tutorial






using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
    public static void Main() {
        string[] presidents = {"A", "A", "B", "Bu", "Car", "land"};

        IEnumerable<string> items = presidents.Take(5);

        foreach (string item in items)
            Console.WriteLine(item);
    }
}








22.71.Take
22.71.1.Take operator outputs the first x elements, discarding the rest
22.71.2.Use Take
22.71.3.Take method
22.71.4.Take and SelectMany
22.71.5.Partitioning Operators: uses Take to generate a sequence of the first three elements of an integer array.
22.71.6.Nested Take
22.71.7.Get the first four element in the list