Solved

Serialization of a Derived Class

Posted on 2013-01-05
6
295 Views
Last Modified: 2013-01-06
When serializing a derived class, the members in its base class are serialized too, correct?
If so, does the base class have to have [Serializable] attribute too?
0
Comment
Question by:metro156
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38747478
What kind of serialization? Binary? XML?
0
 

Author Comment

by:metro156
ID: 38747507
Binary
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38747847
Yes, the base class must be marked as Serializable as well.
0
Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

 

Author Comment

by:metro156
ID: 38748297
So are you saying if base class is not Serialized, program will not compile or runtime error?

Or  Are you saying --if you only Serialize the derived class, the data declared only within the derived class be serialized?
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 300 total points
ID: 38748580
If you serialize the derived class, you will get an exception stating that the base class needs the attribute as well:

Screenshot
0
 

Author Closing Comment

by:metro156
ID: 38749099
Thank you
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question