Friday, October 30, 2009

Serialize Object To File

using System.IO;
using System.Xml.Serialization;

public void SerializeObject(string filename, PersonnelService.PersonnelInput objectToSerialize)
Stream stream = File.Open(filename, FileMode.Create);
XmlSerializer ser = new XmlSerializer(typeof(PersonnelService.PersonnelInput));
ser.Serialize(stream, objectToSerialize);

1 comment:

  1. This is one of those blogs which I follow regularly because I get to know short and simple method for various concept. This time I learned how serialize object to a file. The code is written in simple language. Thanks for the post.
    oracle r12 new features