For example, I have an object with 3 properties: Name, Price and Description. I need to sort a collection of these objects. It's easy to sort by only one parameter:
var sortedList = ObjectCollection.OrderBy(x => x.Name).ToList();
But how to perform the sorting by 2 parameters (Name and Price). For example, I need to get a list like that:
ItemName1 $100 SomeDescription
ItemName1 $200 AnotherDescription
ItemName1 $250 AnotherDescription
ItemName2 $20 AnotherDescription
ItemName2 $40 Description
ItemName3 $100 Description
and so on. So, the main key is a Name, but if there are several items with the same name then the second key is the price. How to do this?