Friday, September 13, 2013

XML Serialization in .Net



XML Serialization is the process of converting an object into XML format
XML format sample



The important features of XML serialization:
1. It converts only public field or property of an object into XML stream.
2. It does not include type information.
3. It does not convert method, indexes, private field or read only property except read only collections.
4. If it is necessary to convert the private field or property of an object, we have to use class DataContractSerializer instead of class XMLSerializer. 
5. Suppose we are adding one new member to serializable class. Here, it can be mapped with the optional Field attribute so that the previous version of the object could serialized without any exception.   
System.Xml.Serialization namespace is used to serialize the object into XML formatted document or steam. Here object may describe as class, method, property, array, primitive types. The main class is XmlSerializer where method Serialize () is used to convert object into XML form and method Deserialize () is used to convert XML stream to corresponding object.



 
 

No comments:

Copyright © Codingnodes,2014.All Rights Reserved.