BinaryFormatter serialization size.

  • Thread starter Thread starter Ken Varn
  • Start date Start date
K

Ken Varn

How can I determine the size of the data that a BinaryFormatter will produce
when serializing an object? I basically want to know how many bytes an
object with SerializableAttribute will produce if it is serialized to a
stream.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
 
Ken said:
How can I determine the size of the data that a BinaryFormatter will
produce when serializing an object? I basically want to know how
many bytes an object with SerializableAttribute will produce if it is
serialized to a stream.

You can't determine that up front, so you have to determine that
using a memorystream and checking the size of the stream after
serializing the data into the memorystream.

FB


--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
Back
Top