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

Hadoop - How to setup a Hadoop Cluster

Below is a step-by-step guide which I had used to setup a Hadoop Cluster Scenario 3 VMs involved: 1) NameNode, ResourceManager - Host...