I have got two classes:
public class Foo
{
public string FooName{get;set;}
public List<Bar> Bars{get;set;}
}
public class Bar
{
public string BarName{get;set;}
}
If I serialize this using the XML parser I come up with:
<Foo>
<FooName>ExampleFooName</FooName>
<Bars>
<Bar>
<BarName>ExampleBarName</BarName>
</Bar>
<Bar>
<BarName>AnotherExampleBarName</BarName>
</Bar>
</Bars>
<Foo>
Is there any way to receive this as the result:
<Foo>
<FooName>ExampleFooName</FooName>
<Bar>
<BarName>ExampleBarName</BarName>
</Bar>
<Bar>
<BarName>AnotherExampleBarName</BarName>
</Bar>
<Foo>
I am looking to either restructure the Foo and Bar classes, or pass in some parameter to the XMLSerializer to receive the result. I really want to avoid writing my own XML parser.
Barsnode do to make you reject it? NowBarsis sad. :(Barswants to know if you'd reconsider.Barsreally wants to make this work out with you.Barsis really sorry to hear that. You've madeBarsvery angry and nowBarsis out to get you. Your code better watch its back!