Hasan Akpürüm
Kıdemli Yazılım Danışmanı
Makele Detayı

Linq Where Simple 2

1/4/2012 2:31:35 PM
public void Linq2() {
List<Product> 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);
}
}
public void Linq2() {    List<Product> 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!
Yorum yaz

Thanks, your message is sent successfully.