Skip to main content
๐Ÿ“œ 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:

  1. static List<string> BigSales(List<Sale> sales, int min) โ€” "Product:Amount" for sales with Amount >= min, ordered by amount descending then product ascending.
  2. static Dictionary<string, int> TotalByRegion(List<Sale> sales) โ€” sum of amounts per region.
  3. static (string Product, int Total)? TopProduct(List<Sale> sales) โ€” product with the highest total amount; null when sales is null/empty. Ties: any.
  4. static double AverageSale(List<Sale> sales, string region) โ€” mean amount for that region; 0.0 when no sales for it. Case-insensitive region match.