0
Answer

Size of serialized object

Ask a question
Administrator

Administrator

21y
1.3k
1
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.