I have this class:
[XmlRoot(\"menuItem\")]
public class MenuItem
{
[XmlAttribute(\"text\")]
public string Text { get; set; }
[XmlAttribute(\"isL
Add XmlArrayItemAttribute
and take away the IsNullable:
[XmlArray("items"), XmlArrayItem("menuItem")]
public List<MenuItem> Items { get; set; }
To get rid of the extra namespaces, you need to use XmlSerializerNamespaces
:
var ns = new XmlSerializerNamespaces();
ns.Add("","");
var ser = new XmlSerializer(typeof (MenuItem));
ser.Serialize(Console.Out, obj, ns);