List <T>. Where Where does not appear in intellisense

I am reading a book by John Skeet and he offers a great example:

List<Product> products = Product.GetSampleProducts();

foreach (Product product in products.Where(p => p.Price > 10))
{
    Console.WriteLine(product);
}

It seems pretty simple to me. But, when I try to do the same, "Where does not appear in intellisense." Am I missing something? It looks the same.

List<lead> prospects = GetAllProspects();

foreach (lead prospect in prospects)
{

}
+3
source share
2 answers

Add a link to System.Linq:

using System.Linq;

Make sure your project targets .Net 3.5 or higher.

+18
source

Are you referring to System.Linq? What is the library in which the Extension Method is located , <...>

+3
source

Source: https://habr.com/ru/post/1792072/


All Articles