I want to serialize a nested object so that its properties are at the same level as the parent object, (ie, NOT in a nested tag). Specifically: I have a C# object:
[XmlRoot(ElementName="Root")]
public class TopLevel
{
public string topLevelProperty;
public NestedObject nestedObj;
}
public class NestedObject
{
string propetyOnNestedObject;
}
and I want XML like:
<root>
<topLevelProperty>...</topLevelProperty>
<propertyOnNestedObject>...</propertyOnNestedObject>
<!--NOTE: propertyOnNestedObject would normally be inside a "<nested>" tag
but I'm trying to avoid that here-->
</root>
Is that possible?