I need help serializing an array without including the array "name". I am
writing in C# and using the XmlSerializer to serial classes.
I am trying to serialize a class with an array in it like the one below.
public class myclass
{
public imagecontext;
public myimage[] images;
}
public myimage
{
public string name;
public string path;
}
It will serialize something like this...
<myclass>
<imagecontext>my context</imagecontext>
<images>
<myimage>
<name>Image1</name>
<path>somepath</path>
</myimage>
<myimage>
<name>Image2</name>
<path>otherpath</path>
</myimage>
</images>
</myclass>
What I would really like is to get the XmlSerializer to not serialize the
name of the array (i.e. <images>). I need for the images to be children of
the <MyClass>, not children of <Images>. I want it to serialize like
below...
<myclass>
<imagecontext>my context</imagecontext>
<myimage>
<name>Image1</name>
<path>somepath</path>
</myimage>
<myimage>
<name>Image2</name>
<path>otherpath</path>
</myimage>
</myclass>