我如何标记 dictionary<string,object> 可以将 string[] 作为具有 v2 序列化的值
How do i mark that a dictionary<string,object> can have string[] as values with v2 serialization
[DataContract]
public class GatewayServiceRegistrationData : IExtensibleDataObject
{
[DataMember]
public Dictionary<string, object> Properties { get; set; } = new Dictionary<string, object>();
}
我在哪里添加已知类型属性,例如 string[] 是放入字典 Properties 中的有效类型。对于服务结构序列化 v2.
[DataContract]
[KnownTypes(typeof(string[]))]
public class GatewayServiceRegistrationData : IExtensibleDataObject
{
[DataMember]
public Dictionary<string, object> Properties { get; set; } = new Dictionary<string, object>();
}
[DataContract]
public class GatewayServiceRegistrationData : IExtensibleDataObject
{
[DataMember]
public Dictionary<string, object> Properties { get; set; } = new Dictionary<string, object>();
}
我在哪里添加已知类型属性,例如 string[] 是放入字典 Properties 中的有效类型。对于服务结构序列化 v2.
[DataContract]
[KnownTypes(typeof(string[]))]
public class GatewayServiceRegistrationData : IExtensibleDataObject
{
[DataMember]
public Dictionary<string, object> Properties { get; set; } = new Dictionary<string, object>();
}