Paging on linq is so much easier then anything I've ever worked with.
consider the following code to add a generic GetPage method in case you use it on several Data Entities in your application:
public static T[] GetPage<T, K>(System.Data.Linq.Table<T> tableObject,
System.Linq.Expressions.Expression<Func<T, K>> orderPred,
int pageSize, int selectedPage) where T : class, new()
{
return tableObject.OrderByDescending(orderPred).Skip(pageSize * (selectedPage - 1)).Take(pageSize).ToArray();
}
public static void Test()
{
// Say this is my Users table:
//User(1,"Ofir")
//User(2,"Yaron")
//User(3,"Danny")
//User(4,"Gila")
//User(5,"Ran")
//User(6,"John")
//User(7,"Marry")
//User(8,"Shay")
//User(9,"Shula")
//User(10,"Moish")
//getting the second page - 4 objects
User[] point = GetPage<User, int>(Utilities.DB.Users, u => u.Id, 4, 2);
//returns:
//Ran
//John
//Marry
//Shay
}