views:

67

answers:

3

like say I want to make a method in my repository like

public IQueryable<Item> GetAllItemsByRange(int start, int end)

and then I just want to pass like (1, 100), (101, 200), (201, 300), etc so I can get back ONLY that range without having to get EVERYTHING at once

thanks!

+5  A: 
queryable.Skip(start - 1).Take(end - start + 1)
Mehrdad Afshari
Beat me by 10 seconds!
Michael
A: 

return (from t in table select t).Skip(start).Take(end - start);

Odd
+1  A: 

orderby is the key, then you can use skip(100).take(100) to do the rest.

Henry Gao