BinaryFormatter serialization size.

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
-----------------------------------
 
F

Frans Bouma [C# MVP]

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#)
------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top