Partitioning Operators: uses Take to generate a sequence of the first three elements of an integer array.
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); } } }
1. | Take operator outputs the first x elements, discarding the rest | ||
2. | Use Take | ||
3. | Take method | ||
4. | Take and SelectMany | ||
5. | Nested Take |