DataTable does not contain definition for AsEnumerable
The method you want is in the System.Data
namespace, so that using
directive is fine, but you also need a reference to the System.Data.DataSetExtensions
assembly. Are you sure you've got that reference as an assembly reference?
It's not clear why you've got a using directive for a System.Data.DataSetExtensions
namespace - does that not raise an error?
What is the exact error with the AsEnumerable()
call? (I'm surprised about the error you're getting with the second form... that's not the error I'd have expected.)
Add System.Data.DataSetExtensions from "nuget" or "add reference"
Add this code:
using System.Data.DataSetExtensions;