Skip to content

Instantly share code, notes, and snippets.

@sclarson
Created May 12, 2011 17:09
Show Gist options
  • Save sclarson/968964 to your computer and use it in GitHub Desktop.
Save sclarson/968964 to your computer and use it in GitHub Desktop.
Generic Serializer
public static void SerializeObjectToFile<T>(string filename, T objectToSerialze)
{
using (Stream stream = File.Open(filename, FileMode.Create))
{
var formatter = new BinaryFormatter();
formatter.Serialize(stream, objectToSerialze);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment