c# - Proper usage of XMLRootAttribute in Monotouch -
i have class called school serializable. when serializes/deserializes need root element called school not school without having change class name school. used xmlroot attribute in following way: [xmlroot(elementname = "school")] i tried: [xmlroot("school")] neither of these did , resulting xml file contained root element called school. am missing something? i not see problem following code works monotouch 4 (maybe you'll find difference between , own code). i defined class like: [xmlroot ("school")] public class wrong { public string name { get; set; } } then serialized memorystream read string. wrong bad = new wrong (); xmlserializer ser = new xmlserializer(typeof(wrong)); using (memorystream ms = new memorystream ()) { ser.serialize (ms, bad); ms.position = 0; streamreader sr = new streamreader (ms); string st = sr.readtoend (); } the ...