Tuesday, May 26, 2009

C# - XML Serialization

C# XML Serialization can be done by

1. Create a serializable class
2. Use a XmlSerializer to serialize and deserialize
3. Use TextWriter and FileStream to write and read from file respectively.

Below are very sample code

A Serializable class - It is a C# class with [Serializable] tag



Write serializable object to xml file




Read xml file and deserialize into object



The resulting xml is



No comments:

Post a Comment

Oracle - Reclaim disk space

Oracle does not release disk space even if you had delete the data or tablespace. If you have enterprise manager, you should use it to  rec...