I’m reading Jon Skeet’s book and he offers a great example:
List<Product> products = Product.GetSampleProducts();
foreach (Product product in products.Where(p => p.Price > 10))
{
Console.WriteLine(product);
}
This seems pretty straightforward to me. But, when I try to do the same, the Where does not show up in the intellisense. Am I missing something? It looks the same.
List<lead> prospects = GetAllProspects();
foreach (lead prospect in prospects)
{
}
Add a reference to System.Linq:
Make sure your project is targeting .Net 3.5 or greater.