I learned C # back in 2006 and recently tried to get back to it. I found out that they have added something called LINQ Extensions to C # 3.0. Now I'm familiar with extension methods, and I'm just thinking about the features of those related to IEnumerables.
Earlier today, I and one of my colleagues discussed whether the following blocks of code are equivalent:
List<int> integers;
IEnumerable<int> subResult = items.Where(i => IsPrime(i));
IEnumerable<int> orderedResult = subResult.OrderBy(i => i);
vs
List<int> integers;
IEnumerable<int> result = items.Where(i => IsPrime(i)).OrderBy(i => i);
He told me that the latter was more efficient because the extension used a late request from its source. I'm not quite sure that I understood what he meant, and I was wondering if he was right.
source
share