Hasan Akpürüm
blog-post-1

Linq Where - DrillDown

public void Linq4() {
List<Customer> customers = GetCustomerList();
var waCustomers =
from cust in customers
where cust.Region == "WA"
select cust;
Console.WriteLine("Customers from Washington and their orders:");
foreach (var customer in waCustomers)
{
Console.WriteLine("Customer {0}: {1}", customer.CustomerID, customer.CompanyName);
foreach (var order in customer.Orders)
{
Console.WriteLine("  Order {0}: {1}", order.OrderID, order.OrderDate);
}
}
}
public void Linq4() {    List<Customer> customers = GetCustomerList(); var waCustomers =        from cust in customers        where cust.Region == "WA"        select cust; Console.WriteLine("Customers from Washington and their orders:");    foreach (var customer in waCustomers)    {        Console.WriteLine("Customer {0}: {1}", customer.CustomerID, customer.CompanyName);        foreach (var order in customer.Orders)        {            Console.WriteLine("  Order {0}: {1}", order.OrderID, order.OrderDate);        }    }} SONUÇ: Customers from Washington and their orders: Customer LAZYK: Lazy K Kountry Store Order 10482: 21.03.1997 00:00:00 Order 10545: 22.05.1997 00:00:00 Customer TRAIH: Trail's Head Gourmet Provisioners Order 10574: 19.06.1997 00:00:00 Order 10577: 23.06.1997 00:00:00 Order 10822: 08.01.1998 00:00:00 Customer WHITC: White Clover Markets Order 10269: 31.07.1996 00:00:00 Order 10344: 01.11.1996 00:00:00 Order 10469: 10.03.1997 00:00:00 Order 10483: 24.03.1997 00:00:00 Order 10504: 11.04.1997 00:00:00 Order 10596: 11.07.1997 00:00:00 Order 10693: 06.10.1997 00:00:00 Order 10696: 08.10.1997 00:00:00 Order 10723: 30.10.1997 00:00:00 Order 10740: 13.11.1997 00:00:00 Order 10861: 30.01.1998 00:00:00 Order 10904: 24.02.1998 00:00:00 Order 11032: 17.04.1998 00:00:00 Order 11066: 01.05.1998 00:00:00

Yorum Yaz