Convert Linq Result Set to DataTable
January 16, 2008 at 7:43 AM
I'm in the process of evaluating Linq by converting an existing data layer from using Subsonic to to using Linq queries. One challenge with this, of course, is trying not to change method signatures in the process. I have some methods that return DataSets and was stressing over having to modify all the logic that called the methods to consume a return type of var, or a collection of entity classes instead. Thankfully, while looking for possible solutions to the problem, I stumbled over this article from CoDe Magazine that contains code for an extension method that converts a Linq result into a DataTable.