Re: Binary serialization
- From: "Frans Bouma [C# MVP]" <perseus.usenetNOSPAM@xxxxxxxxx>
- Date: Mon, 26 Jun 2006 08:07:20 -0700
Jacques wrote:
Hi
I am an dotNet newby, so pardon my ignorance.
I am looking for a method of saving/copying a managed class to a
stream/file WITHOUT saving the object's state, eg. if I have a ref
class with two int32's as its data members, the binary file of that
class must have a size of 8 bytes (i.e. only contains class data
members, not methods etc.).
Is serialization the answer to the above problem?
No.
Binary serialization is a mechanism which writes _that_ data to the
output stream which is necessary to re-create the object when reading
that precise data. I.o.w.: you get the contents + extra fluff. If you
want to save 8 bytes, you should grab the 8 bytes and write them
yourself. Though I fail to see the necessity for files of 8 bytes. This
thus leads to the assumption that you want to save the data of a lot of
objects into one file. If you do that yourself, you can end up with a
compact file, but also with a lot of code, or better: more code than
you would end up with when you would just go for the binary formatter
approach.
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#)
------------------------------------------------------------------------
.
- Prev by Date: Re: modem
- Next by Date: Re: checking free disk space w/ .NET....
- Previous by thread: Re: Binary serialization
- Next by thread: Re: Binary serialization
- Index(es):
Loading