using(var context = new MyDbContext()) { IQueryablecustomersQuery = from c in context.Customers where c.Age > 18 select c; }
XElement customersElement = XElement.Load("customers.xml"); IQueryablecustomersQuery = from c in customersElement.Elements("customer") where (string)c.Attribute("gender") == "female" select c;
ListThese examples are a part of the System.Linq namespace in the .NET framework.customers = new List { new Customer { Name = "John", Age = 22 }, new Customer { Name = "Mary", Age = 24 }, new Customer { Name = "Bob", Age = 18 } }; IQueryable customersQuery = customers.AsQueryable().Where(c => c.Age > 20);