Select from following answers:- var sortedProds = _db.Products.Orderby(c => c.ProductCategory)
- var sortedProds = _db.Products.Orderby(c => c.ProductCategory) + ThenBy(n => n.ProductName)
- var sortedProds = _db.Products.Orderby(c => c.ProductCategory) . ThenBy(n => n.ProductName)
- All of the mentioned
- All Above
The first option is wrong since we have sorted only based on the ProductCategory
Option 2 is incorrect since '+' is not a valid overloaded operator between the OrderBy and ThenBy extension methods.
In Option 3, we are first sorting by ProductCategory followed by ProductName which is the requirement and henceforth it is the right answer.
Show Correct Answer
Asked In: Many Interviews |
Alert Moderator