NOTE: Charlie Calvert replied below that 101 LINQ Samples has now been updated with the correct code.
Visual C # MSDN Developer Center has 101 LINQ samples . I found this through a Bing search.
SelectMany Code - Connection of 1 :
public void Linq14() { int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 }; int[] numbersB = { 1, 3, 5, 7, 8 }; var pairs = from a in numbersA, b in numbersB where a < b select new {a, b}; Console.WriteLine("Pairs where a < b:"); foreach (var pair in pairs) { Console.WriteLine("{0} is less than {1}", pair.a, pair.b); } }
However, this code will not compile . I noticed that if I remove the comma at the end from a in numbersA, and instead add from before b in numbersB , it will compile and work fine:
var pairs = from a in numbersA from b in numbersB where a < b select new {a, b};
I am not sure if this is an error in the MSDN example or maybe I am running a C # and .NET version that does not support this syntax.
If I look at the palette at the top of page 101 of LINQ Samples , I see that it says โFuture Versionsโ. Does this mean that future versions of C # /. NET will support using a comma instead of from in LINQ syntax?

I am using Visual Studio 2008 Standard with .NET 3.5 SP1.