Partitioning Operators: uses Take to generate a sequence of the first three elements of an integer array. : Take « LINQ « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {

        int[] numbers = { 5, 4, 1, 3, 9};

        var first3Numbers = numbers.Take(3);

        Console.WriteLine("First 3 numbers:");
        foreach (var n in first3Numbers) {
            Console.WriteLine(n);
        }
    }
}








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