LINQ examples

M

Mike P

I am running through the LINQ examples on the Microsoft site and I am
wondering where the List object below is coming from? What classes do I
need to add to my page to be able to use this List object?

public void Linq3() {
List products = GetProductList();

var expensiveInStockProducts =
from p in products
where p.UnitsInStock > 0 && p.UnitPrice > 3.00M
select p;

Console.WriteLine("In-stock products that cost more than 3.00:");
foreach (var product in expensiveInStockProducts) {
Console.WriteLine("{0} is in stock and costs more than 3.00.",
product.ProductName);
}
}
 
M

Marc Gravell

Can you give a url to that?

I suspect that should be List<Product> or similar (i.e.
System.Collections.Generic.List<T>)... but perhaps the <Product> got
treated as html and hidden... a common issue between generics and
html...

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top