I'm not sure how this piece of code works.
[Serializable] class Blah { public Blah(int value) { this.value = value; } public int value; } BinaryFormatter b = new BinaryFormatter(); Blah blah = new Blah(4); MemoryStream s = new MemoryStream(); b.Serialize(s, blah); s.Seek(0, SeekOrigin.Begin); blah = null; blah = (Blah)b.Deserialize(s);
Since I don't have a constructor without parameters, it seems strange that the deserializer can create a new instance of Blah.
Jamie source share