Linq Where Smiple 2
2/23/2013 6:17:59 AM
public void Linq2() {
List
products = GetProductList();
var soldOutProducts =
from prod in products
where prod.UnitsInStock == 0
select prod;
Console.WriteLine("Sold out products:");
foreach (var product in soldOutProducts) {
Console.WriteLine("{0} is sold out!", product.ProductName);
}
}
SONUÇ:
Sold out products:
Chef Anton's Gumbo Mix is sold out!
Alice Mutton is sold out!
Thüringer Rostbratwurst is sold out!
Gorgonzola Telino is sold out!
Perth Pasties is sold out!