我有一个包含许多标准字段和一个arraylist的类.
有没有办法使用XmlSerializer序列化类?
到目前为止尝试导致错误消息说:
Unhandled Exception: System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type XMLSerialization.DataPoints was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
类的一些简要表示如下所示:
public class StationData
{
private DateTime _CollectionDate;
private string _StationID;
private ArrayList _PolledData;
public StationData()
{
}
public DateTime CollectionDate
{
get { return _CollectionDate; }
set { _CollectionDate = value; }
}
public string StationID
{
get { return _StationID; }
set …Run Code Online (Sandbox Code Playgroud) c# ×1