5.1.6 Using Lambda Expression

e.g. 5.22 Extending the Filtering Expression by Lambda
This commit is contained in:
Jason Zhu 2021-07-12 13:36:35 +10:00
parent 0e57f0e2e8
commit a376175c76

View File

@ -21,7 +21,9 @@ namespace automatically_implemented_properties
}
};
IEnumerable<Product> filteredProducts = products.Filter(prod => prod.Category == "Soccer");
IEnumerable<Product> filteredProducts = products.Filter(prod =>
prod.Category == "Soccer" ||
prod.Price > 20);
foreach (Product prod in filteredProducts)
{