M
Martijn Saly
I have a class that looks like this (simplified):
public class Field {
public string Name;
public string Value;
}
I'm creating a webmethod that has this class as an argument, and the
following SOAP fragment for that is expected:
<Field>
<Name>string</Name>
<Value>string</Value>
</Field>
I want to make this (de)serialized as:
<Field Name="string">string</Field>
This would, of course eat up less bandwidth, and it looks more logical
for a little name/value-class. I've tried adding [XmlAttribute("Name")]
to the Name property, and that works perfectly. So I get this:
<Field Name="string">
<Value>string</Value>
</Field>
Which looks even more silly, I think. So how do I get the aforementioned
way of (de)serialization? Any thoughts/ideas?
public class Field {
public string Name;
public string Value;
}
I'm creating a webmethod that has this class as an argument, and the
following SOAP fragment for that is expected:
<Field>
<Name>string</Name>
<Value>string</Value>
</Field>
I want to make this (de)serialized as:
<Field Name="string">string</Field>
This would, of course eat up less bandwidth, and it looks more logical
for a little name/value-class. I've tried adding [XmlAttribute("Name")]
to the Name property, and that works perfectly. So I get this:
<Field Name="string">
<Value>string</Value>
</Field>
Which looks even more silly, I think. So how do I get the aforementioned
way of (de)serialization? Any thoughts/ideas?