Posted By

mtelligent on 05/04/09


Tagged

Generic XmlSerialization


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

paelgr
umang_nine
vali29
ethedy
khouser
ovuncgursoy


Serialize Object To String


 / Published in: C#
 

  1. public string SerializeToString<T>(T obj)
  2. {
  3. StringWriter sw = new StringWriter();
  4.  
  5. XmlSerializer serializer = new XmlSerializer(typeof(T));
  6. serializer.Serialize(sw, obj);
  7.  
  8. return sw.ToString();
  9. }

Report this snippet  

You need to login to post a comment.