serializing lists classes xml
i have collection classes i wish serialize out an xml file. looks something this:
public category foo
{
open list<bar> barlist { get; set; }
}
where bar only coupling collection properties, this:
public category bar
{
open twine property1 { get; set; }
open twine property2 { get; set; }
}
i wish symbol adult outputs an xml record - used both persistence, also news settings around an xslt good human-readable form.
i wish good xml illustration this:
<?xml version="1.0" encoding="utf-8"?>
<foo>
<barlist>
<bar>
<property1>value</property1>
<property2>value</property2>
</bar>
<bar>
<property1>value</property1>
<property2>value</property2>
</bar>
</barlist>
</foo>
where bars barlist combined out properties. i'm sincerely certain i'll need markup category construction work, nonetheless i can't seem right combination.
i've noted foo charge
[xmlroot("foo")]
and list<bar>
attribute
[xmlarray("barlist"), xmlarrayitem(typeof(bar), elementname="bar")]
in an try tell serializer i wish happen. doesn't seem work however i only an lifeless tag, looking this:
<?xml version="1.0" encoding="utf-8"?>
<foo>
<barlist />
</foo>
i'm certain fact i'm controlling involuntary properties should have any effect, generics requires any special treatment. i've gotten work easier forms list strings, nonetheless list classes distant eludes me.
Comments
Post a Comment