A
Andrus
For paged data access I need to convert result of DLinq query to something
(list or array) which can be accessed by integer index.
I use for this metod below.
Is it best solution to use foreach (var e in q) for this?
Andrus.
IList<object> SupplyPageOfData(int lowerPageBoundary, int rowsPerPage)
{
Northwind db = CreateDB();
var oq = from c in db.Customers
select new { name = c.CompanyName, contact =
c.ContactName };
oq = oq.Skip(lowerPageBoundary).Take(rowsPerPage);
var q = oq.ToList();
List<object> list = new List<object>();
foreach (var e in q)
list.Add(e);
return list;
}
(list or array) which can be accessed by integer index.
I use for this metod below.
Is it best solution to use foreach (var e in q) for this?
Andrus.
IList<object> SupplyPageOfData(int lowerPageBoundary, int rowsPerPage)
{
Northwind db = CreateDB();
var oq = from c in db.Customers
select new { name = c.CompanyName, contact =
c.ContactName };
oq = oq.Skip(lowerPageBoundary).Take(rowsPerPage);
var q = oq.ToList();
List<object> list = new List<object>();
foreach (var e in q)
list.Add(e);
return list;
}