Search code examples
c#visual-studio-macsystem.data

DataTable.AsEnumerable() does not Exist on my Visual Studio For Mac System.Data


I downloaded Visual Studio for Mac to give it a try. I am working with data and linq. When I try the following, AsEnumerable does not exist.

using System.Linq;
using System.Data;

namespace TestingDataTable2
{
    class Program
    {
        static void Main(string[] args)
        {
            DataTable dt = new DataTable();
            var query = from r in dt.AsEnumerable()

        }
    }
}

Has anyone else ran into this problem with VS for Mac. If I go into my References it is blank. This seems like a fairly important feature to leave out, and I am wondering if this is the case, or if I did something wrong when downloading.

Edit: Error Message is - 'DataTable' does not contain a definition for 'AsEnumerable' and no accessible extension method 'AsEnumerable' accepting a first argument of type 'DataTable' could be found (are you missing a using directive or an assembly reference?)


Solution

  • Did you install the System.Data.DataSetExtensions package from NuGet?

    https://www.nuget.org/packages/System.Data.DataSetExtensions/4.5.0