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);
}
}
Marc Gravell - 29 Apr 2008 13:32 GMT
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
Marc Gravell - 29 Apr 2008 13:46 GMT
This? http://msdn2.microsoft.com/en-us/vcsharp/aa336746.aspx
Yes - looks like the generics got lost... that isn't going to make it
very easy to follow. I tried "Contact Us", but the link is dead...
unusually sloppy for msdn.
It is hit'n'miss which samples work (unfortunately) - i.e. it is fine
here:
http://msdn2.microsoft.com/en-us/vcsharp/aa336754.aspx
but broken here:
http://msdn2.microsoft.com/en-us/vcsharp/aa336760.aspx
Marc