Example of Take Function in LinQ

Introduction
 

 The Keywork Take in the linq is a function which is used to retrive number of recornds mention in the parameter of take function. suppose you want to retrive 14 record out of rows those matches your condition from your database table.
 
 Fore Example
 

 In this example i have an array of integer that contains 9 items and i want show only 3 items,bellow code shows how can display only 3 items out of 9 items.
 
 int[] intigerarray = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
 foreach (int ind in intigerarray.Take(3))
 {
 Console.WriteLine(ind);
 }
Ebook Download
View all
Learn
View all