From the given Product List
List<Product> productList = new List<Product>();
productList.Add(new Product("P001", 34566.78M, "North"));
productList.Add(new Product("P004", 4566.78M, "East"));
productList.Add(new Product("P007", 14566.78M, "South"));
productList.Add(new Product("P010", 2456.178M, "South"));
productList.Add(new Product("P011", 341566.78M, "North"));
productList.Add(new Product("P006", 64566.878M, "East"));
productList.Add(new Product("P00188", 664566.78M, "East"));
productList.Add(new Product("P00111", 3444566.78M, "North"));
productList.Add(new Product("P00134", 3234566.78M, "South"));
How to select Top 2 Product (price based) from each region ?
I have written something like
var query = productList.OrderByDescending(p => p.ProductPrice).
Take(2).GroupBy(r => r.Region);