locked
SerializeObject RRS feed

  • Question

  • i done Serialize and Deserialize my object.

    my Serialized output of my object like..

    <Student>

    <name>XXX</name>

    <age>23</age>

    </Student>.

     

    But i need the xml document like ..

    <Student name="XXX" age="23" />

    what is the best way to this xml conversion?

     

    -Sivakumar.G

    Wednesday, November 24, 2010 12:27 PM

All replies

  • You can specify this defining your class as following:

     

    public class Student

    {

             [XmlAttribute("name")
             string Name {get;set;}

     ....

    }

    • Proposed as answer by AbdElRaheim Saturday, January 15, 2011 4:54 AM
    Monday, November 29, 2010 3:58 PM