Your application uses LINQ to SQL to retrieve Product entities to display in a window. The window uses paging to display 25 results at a time. You add the following method:

public IEnumerable<Product> GetProducts(int pageNumber)
{
var query = from c in db.Customers
select c.CompanyName;
}

You need to add code to return only the subset of rows that will be shown on the page number given by pageNumber.

Which code segment should you add?

 Posted by Rajkatie on 8/31/2012 | Category: ADO.NET Interview questions | Views: 2477 | Points: 40
Select from following answers:
  1. return query.Skip((pageNumber - 1) * 25).Take(25);
  2. return query.Take((pageNumber - 1) * 25).Skip(25);
  3. return query.Take((25).Skip(pageNumber - 1));
  4. All Above

Show Correct Answer


Source: MeasureUp.Com | | Alert Moderator 

Comments or Responses

Login to post response