Avatar ·

Grouping by multiple fields using LINQ in C#

Hello everyone! I'm a beginner C# developer and I've encountered a problem when using LINQ. I have a list of `Sale` class objects that contains sales information: store name (`Store`), date (`Date`), and sale amount (`Amount`). I need to group all sales by store and by date (i.e., get the total amount for each store for each day). Here is my class: ```csharp public class Sale { public string Store { get; set; } public DateTime Date { get; set; } public decimal Amount { get; set; } } ``` And example data: ```csharp var sales = new List { new Sale { Store = "Store A", Date = new DateTime(2023, 1, 1), Amount = 100 }, new Sale { Store = "Store A", Date = new DateTime(2023, 1, 1), Amount = 150 }, n ```