在发送到线路之前,我遇到了序列化对象的问题。
基本上我希望我的对象被序列化为
<verb operation="and">Show</verb>
然而它忽略了属性
<verb>Show</verb>
以下是客户端代理代码
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.2152")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.starstandards.org/webservices/2005/10/transport")]
public enum OperationEnumeratedType
{
/// <remarks/>
///
and,
/// <remarks/>
///
or,
/// <remarks/>
///
not,
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
public OperationEnumeratedType operation
{
get
{
return this.operationField;
}
set
{
this.operationField = value;
}
}
以下是我如何创建此对象。
verb = new CriteriaLogicStringType
{
operation = OperationEnumeratedType.and,
Value = "Show"
}
有谁知道如何让操作属性出现在序列化的xml中?
由于
答案 0 :(得分:1)
您应该使用EnumMemberAttribute装饰OperationEnumeratedType
枚举的成员,如下所示:
[DataContract]
public enum OperationEnumeratedType
{
[EnumMember]
And,
[EnumMember]
Or,
[EnumMember]
Not
}
相关资源: