1

I believe the following should work:

IEnumerable<DataRow> d = myDataTable.AsEnumerable();

But it doesn't! I get:

Error CS1061: Type System.Data.DataTable does not contain a definition for AsEnumerable and no extension method AsEnumerable of type System.Data.DataTable could be found (are you missing a using directive or an assembly reference?)

I have System.Data.DataSetExtensions as a reference and this is Mono 3.5 and MonoDevelop 2.4.2. I also have

using System;
using System.Data;
using System.Data.Linq;
using System.Collections.Generic;
Dan Abramov
  • 264,556
  • 84
  • 409
  • 511
Ben B.
  • 3,706
  • 5
  • 26
  • 27

1 Answers1

0

I don't know what's your problem and cannot test now but I would definitely start with trying to call extension method directly:

var rows = DataTableExtensions.AsEnumerable(myDataTable);

This will give you some insight on what exactly fails, if this is a namespace, class or method problem.

By the way, there is no Mono 3.5 so you might really be using an old version.
Current version is 2.10.

Mono versions don't go along with .NET version numbers, however you can expect Mono 2.10 to support most of the LINQ goodness (at least for DataSet).

Dan Abramov
  • 264,556
  • 84
  • 409
  • 511
  • I guess by mono 3.5 I meant the one compatible with most of .NET 3.5 – Ben B. Aug 09 '11 at 21:14
  • @Ben: there are plently of Mono versions **compatible with .NET 3.5 on different levels** so it's always good to know the exact version when hunting down a problem. – Dan Abramov Aug 09 '11 at 21:16