Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

Size of serialized object

Mar 7 2003 5:43 AM
How do I know the size of a serialized object ? For example: Stream s = File.Open("myfile.dat", FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(s, myobject); What was the size of myobject written to the file s ? I know I could compare the size of the file before and after and the difference would be it, but this is not precise since another write could be done right before the call to check the file size. Thanx in advance for any help.