๐ WAYPOINT LESSON
Checkpoint โ LINQ
โญ beginnerโณ 20 min read๐ Lesson 61 of 85
A sales report: filter, project, order, group, and aggregate in one pipeline over transaction rows.
Checkpoint: the sales report
Task: given record Sale(string Region, string Product, int Amount) and a List<Sale>, implement in Solution:
static List<string> BigSales(List<Sale> sales, int min)โ"Product:Amount"for sales withAmount >= min, ordered by amount descending then product ascending.static Dictionary<string, int> TotalByRegion(List<Sale> sales)โ sum of amounts per region.static (string Product, int Total)? TopProduct(List<Sale> sales)โ product with the highest total amount; null when sales is null/empty. Ties: any.static double AverageSale(List<Sale> sales, string region)โ mean amount for that region; 0.0 when no sales for it. Case-insensitive region match.