Q:

Assume 2 columns named as Product and Category how can be both sorted out based on first by category and then by product name?

(a) var sortedProds = _db.Products.Orderby(c => c.Category)

(b) var sortedProds = _db.Products.Orderby(c => c.Category) + ThenBy(n => n.Name)

(c) var sortedProds = _db.Products.Orderby(c => c.Category) . ThenBy(n => n.Name)

(d) all of the mentioned

This question was posed to me by my school principal while I was bunking the class.

Question is taken from Fundamental of LINQ in division Delegates, Generics and LINQ of C#

C#

All Replies

Viewing 1 replies (of 1 total)

Viewing 1 replies (of 1 total)

  • You must be logged in to reply to this topic.