Posted By

jalalx on 01/18/11


Tagged

xml Serializer


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

cybermax
ovuncgursoy


XML Serializer


 / Published in: C#
 

XML Serialize an object of type T.

  1. public static void XmlSerialize<T>(string filename, T o)
  2. {
  3. try
  4. {
  5. XmlWriter writer = XmlWriter.Create(filename);
  6. XmlSerializer serializer = new XmlSerializer(typeof(T));
  7. serializer.Serialize(writer, o);
  8. writer.Close();
  9. }
  10. catch
  11. {
  12. }
  13. finally
  14. {
  15. }
  16. }

Report this snippet  

You need to login to post a comment.