IQueryable<T> vs. IEnumerable<T>

LINQ over DataSet contains two extension methods on DataTable that allow the data in a DataTable to accessed by LINQ. One exposes the data as IQueryable<DataRow> and the other as IEnumerable<DataRow>. Why is this, and what are these two interfaces?   When you read about LINQ, you see that IEnumerable<T> is the interface that is…

1

Exploring Extension methods – potential method invocation problems

Extension methods are one of the many great new features of C# 3.0. They basically allow you to declare static methods that appear to be instance methods of a type, even if you have no access to the type (sealed classes, etc). The key point is that you don’t need to recompile or even have…

3

When to not cast to Anonymous types

I was doing some tests on LINQ over DataTables where I was selecting into a new anonymous type. The code was quite simple, just doing a basic select.   var res = from n in contacts.Contact    where n.LastName.StartsWith(“L”)                select new {n};     Looking at the debugger, res is a WhereIterator, where the…

0