The C# class listed below produces this XML:
<Standardize><TestString>Some Data</TestString></Standardize>
However, what I’d like is this:
<Standardize>Some Data</Standardize>
In other words, I want the contents of the TestString property to show up in the XML, but I don’t want the TestString property to be listed as an element. Can I add some attributes to make this happen?
/// <Serialized C# Class/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://test.com/Services/1")]
public partial class Standardize {
private string testField;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.None, IsNullable=true, ElementName=null)]
public string TestString {
get {
return testField;
}
set {
testField;= value;
}
}
}
Decorate
TestStringwithXmlTextinstead ofXmlElement.