简体   繁体   中英

Class Library (Portable for iOS, Android and Windows)

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM