Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

BinaryFormatter produce larger file after ISerializable implemente

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Slava - 09 Mar 2006 10:59 GMT
Question about serialization to binary format under .Net 1.1 using C#.

I have some set of classes, some of them are marked with
SerializableAttribute. I use serialization to binary files to persist some
object graph between app sessions.

I've made an easy change to my code: each class which is marked as
Serializable implements ISerializable i-face now, and contains
deserialization ctor. The GetObjectData method is implemented very easy: each
field that was serialized automatically is added to SerializationInfo now by
call to AddValue.

Now, what is my problem. If I serialize an object graph to file by
BinaryFormatter using new classes version (ISerializable) I got a larger file
(about 2 times) that before.

Why??
Slava - 09 Mar 2006 18:15 GMT
It looks like the problem is because of serialization of descendants of
abstract classes, but I'm not sure.

Any ideas?
Robert Hooker - 09 Mar 2006 20:26 GMT
Woohoo!! Someone else noticed my favorite problem!

See this thread:
http://groups.google.com/group/microsoft.public.dotnet.framework/browse_frm/thre
ad/2615e1f489e7a916/c94132480ff4eeb2?tvc=1&q=group%3A*dotnet*+author%3AHooker&hl
=en#c94132480ff4eeb2


For a detailed - and sometimes painful - history.

The short answer to your question (and it isn't really an answer) was given
at the end of the chain:

****************
AFAIK, the builtin serialization will optimize for better performance under
certain circumstances. While for custom serialization, it has to strictly
follow the ISerializable.GetObjectData() you provided to repeat an extra
100 times of "SerializationTest.ChildNodeval1parentsubNode" as in this
case.
****************

Cheers,
Rob

> Question about serialization to binary format under .Net 1.1 using C#.
>
[quoted text clipped - 16 lines]
>
> Why??
Slava - 10 Mar 2006 07:29 GMT
And there is no new info about the issue since March 2004?

> Woohoo!! Someone else noticed my favorite problem!
>
> See this thread:
> http://groups.google.com/group/microsoft.public.dotnet.framework/browse_frm/thre
ad/2615e1f489e7a916/c94132480ff4eeb2?tvc=1&q=group%3A*dotnet*+author%3AHooker&hl
=en#c94132480ff4eeb2

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.