Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


i have to convert like this

class test=new class();

test.name="raju";

convert this in to xml

test as root tag and

name as sub tag




Thanks in adv,

Ragards,
Rahul.
Posted

See the following link which is already discussed with a good example

serializing-lists-of-classes-to-xml
 
Share this answer
 
You may try this...

C#
public string EntityToXML()
    {
        var stringwriter = new System.IO.StringWriter();
        var serializer = new XmlSerializer(this.GetType());
        serializer.Serialize(stringwriter, this);
        return stringwriter.ToString();
    }
 
Share this answer
 
Comments
naveen pallela 22-Nov-13 6:59am    
Thanks you Its Working Sorry for The Late Reply.
You can refer the below link which will help you

http://tech.pro/tutorial/798/csharp-tutorial-xml-serialization[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900