我刚刚更新到 r275 版本,它似乎不再正确管理 DataContract 类通过序列化这个非常简单的类:
[DataContract]
public class ProtoData
{
[DataMember(Order = 1)]
private long _id;
[DataMember(Order = 2)]
private string _firstName;
[DataMember(Order = 3)]
private string _lastName;
public long Id
{
get { return _id; }
set { _id = value; }
}
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
public ProtoData(long id, string firstName, string lastName)
{
_id = id;
_firstName = firstName;
_lastName = lastName;
}
public ProtoData()
{
}
我得到只有数据合同类(以及此类列表/数组)可以被处理(错误处理 ProtoData)