Advertise here


Tag cloud


 

You are currently browsing the archives for the Lambda Expressions category.

Archive for the ‘Lambda Expressions’ Category

Set Start Index & Max Rows

Posted on Wednesday, October 5th, 2011 in Lambda Expressions

How to set a start index and max rows like in MySQL limit but using Lambda Expressions in c-sharp:

.skip() = start index

.take() = max rows

Example: If you had a list of twenty items and you only wanted to get the last five items.

var ItemList = Got.From.DataSource();
foreach(var Item in ItemList.Skip(15).Take(5)){
       //output result;
}

This saves you from querying your data source to get a set of results that might need to be displayed in different ways.



Web Design Essex | Richard Kotze – Web Technology, Design and Development powered by WordPress | Entries (RSS)