private void WriteObject(object graph) { // thanks to Iulian Dan Repolschi for reminding me // how important it is to close a file :-) using (FileStream stream = CreateTargetFile()) { new BinaryFormatter().Serialize(stream, graph); } }