Customer {
int CustomerId,
string Name,
string Country,
string Email,
string Phone
}
If you want to create a List<Customer> where customer country = UK then you can use the below syntax.
List<Customer> ukCustomers =
Customers.FindAll(customer => customer.Country.ToUpper().Equals("UK"))
If you want to do the same thing using LINQ
List<Customer> ukCustomers = from Customer customer in Customers
where customer.Country.ToUpper().Equals("UK")
select customer
No comments:
Post a Comment