Friday, November 13, 2009

Errors in MSDN samples for LINQ

Microsoft has put on his site samples for LINQ. But on that page there are several errors. For example http://msdn.microsoft.com/en-us/vcsharp/aa336758.aspx#SelectManyCompoundfrom1 explain how to use "compound from". In theirs example it's written:

var pairs =
from a in numbersA,
b in numbersB
where a < b
select new {a, b};

but if you try this code you will get compile error:
"A query body must end with a select clause or a group clause"

The code should be:

var pairs =
from a in numbersA
from b in numbersB
where a < b
select new {a, b};

I am wondering how they gets their results.

No comments: