|
by Eric Lippert via Fabulous Adventures In Coding on 5/9/2008 3:20:00 PM
A few short takes today, from questions I've received recently about LINQ in C# 3.0.
The first question was "in the following code, does it really check every single non-negative integer, or does it use the knowledge that once you're beyond ten, you can stop iterating?"
var smallNumbers = Enumerable.Range(0, int.MaxValue).Where(n => n < 10);foreach (int i in smallNumbers) Console.WriteLine(i);The former. You asked LINQ to Objects to apply a predicate to a sequence
... [ read more ]
|
|