Skip to content
Skip to content
sujatad.net

Blogging about technology and leadership

← Learning LINQ – Extension methods
ADO.NET Data services →
-->

Learning LINQ – skip

Posted on May 25, 2008 by sujatad

Example 1:

var myPageQuery = from i in myPages
select i;

var startValue = 1;
var numberPages = 3;

//To get 3 pages
var collectionOfPages = myPageQuery.Skip(startValue).Take(numberPages);

Example 2:

int[] carSales = { 5, 200, 10, 9, 50, 60, 99, 77 };
IEnumerable orderedCarSales = carSales.OrderByDescending(g => g).Skip(2);
Console.WriteLine(“Car sales except the top two are:”);
foreach (int car in orderedCarSales)
{
Console.WriteLine(car);
}

Should see the following results:
77,60,50,10,9,5

About sujatad

Technical Blogger
View all posts by sujatad
This entry was posted in Uncategorized. Bookmark the <a href="https://sujatad.net/uncategorized/learning-linq-skip/" title="Permalink to Learning LINQ – skip" rel="bookmark">permalink</a>.
← Learning LINQ – Extension methods
ADO.NET Data services →

Comments are closed.

© 2025 | Blog info WordPress Theme | By Bharat Kambariya