Reputation: 37
I have built a Class Library (Portable for iOS, Android and Windows) in VS2015.
I created a public class that having a data type with DataTable.
public class PNAWcfData
{
public int CmdTimeout { get; set; }
public string ErrMsg { get; set; }
public DataTable DTResult { get; set; }
public string XmlResult { get; set; }
}
However, I got error when build the solution.
“The type or namespace name 'DataTable' could not be found (are you missing a using directive or an assembly reference?)”
I tried to add the using System.Data but still getting the same error. Also tried to add from Project->Reference, but it is telling that component is already automatically referenced by the build system.
Any idea why I am getting this error?
Upvotes: 0
Views: 460
Reputation: 1069
DataTable classes are not available in the PCL. This is a duplicate of Can you use DataSet and DataTables in a Portable Class Library
If you are using Xamarin, you may consider switching to Shared Project instead of PCL.
Upvotes: 1