我有 DataContract (BalanceClassificationAttribute),它有一个对象类型的字段。
[DataContract]
[KnownType(typeof(string))]
[KnownType(typeof(long))]
[KnownType(typeof(int))]
[KnownType(typeof(uint))]
public class BalanceClassificationAttribute
{
/// <summary>
/// Value of searching attribute.
/// </summary>
[DataMember]
public Object Value
{
get;
set;
}
}
该字段的值可以是 string、long、int、uint
A 添加了这些属性字节
[KnownType(typeof(string))]
[KnownType(typeof(long))]
[KnownType(typeof(int))]
[KnownType(typeof(uint))]
但是这个 DataContract 不起作用。我还能做什么?