Solved

Serialization of a Derived Class

Posted on 2013-01-05
6
292 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

777 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