Skip to content

Instantly share code, notes, and snippets.

@bleroy
Created January 4, 2017 00:21
Show Gist options
  • Save bleroy/4875182195cbe87d565f8c9dfea73f36 to your computer and use it in GitHub Desktop.
Save bleroy/4875182195cbe87d565f8c9dfea73f36 to your computer and use it in GitHub Desktop.
var person = new Person {
Id = 12345, Name = "Fred",
Address = new Address {
Line1 = "Flat 1",
Line2 = "The Meadows"
}
};
using (var file = File.Create("person.bin")) {
Serializer.Serialize(file, person);
}
Person newPerson;
using (var file = File.OpenRead("person.bin")) {
newPerson = Serializer.Deserialize<Person>(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment