LINQ and paging with a DataTable - can't get Skip working?
        Posted  
        
            by Kit Menke
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Kit Menke
        
        
        
        Published on 2010-06-16T17:54:50Z
        Indexed on 
            2010/06/16
            18:02 UTC
        
        
        Read the original article
        Hit count: 322
        
Ok so this might be a dumb question, but I can't seem to figure it out. I thought I'd try out LINQ against a DataTable. I got my query working and now I'm trying to implement some simple paging.
DataTable dataTable = null;
dataTable = GetAllDataTables();
var query = from r in dataTable.AsEnumerable()
            orderby r.Field<string>(Constants.fileName)
            select r;
query.Skip(WPP_PAGE_SIZE * pageIndex).Take(WPP_PAGE_SIZE);
My problem is that I get an error at query.Skip(...).
Error 1 'System.Data.OrderedEnumerableRowCollection' does not contain a definition for 'Skip' and no extension method 'Skip' accepting a first argument of type 'System.Data.OrderedEnumerableRowCollection' could be found (are you missing a using directive or an assembly reference?)
References I have:
- Microsoft.SharePoint
 - System
 - System.Core
 - System.Data
 - System.Data.DataSetExtensions
 - System.Web
 - System.Xml
 
What am I missing?
© Stack Overflow or respective owner