Input: IEnumerable
Lambda Expression: int
Take emits the first n elements and discards the rest;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
string[] names = { "Java", "C#", "Javascript", "SQL", "Oracle", "Python", "C++", "C", "HTML", "CSS" };
IEnumerable query = names.Take(2);
foreach (string s in query)
{
Console.WriteLine(s);
}
}
}
The output:
Java
Javascript
Oracle
C++
HTML