Linq to objects is a misnomer

by Marius Gheorghe 14. March 2008 14:53
Linq to objects is a misnomer. Linq to IEnumerable(of T) would be better. The idea is that, when you're writing Linq code, it should be VERY VERY easy to "grok" against what "data source" the query it's going to run.
Here's a simple example :

from s in File.RealAllLines("blah.txt")

should be written as

string[] lines = File.ReadAllLines("blah.txt");
var f = from s in lines

In the second case it should be clear that you reading all the contents of that file in memory and the query is running "against" a string[].

Tags:

dotNET