Solved

Serialization of a Derived Class

Posted on 2013-01-05
6
294 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending an input value from a view to a controller in MVC 3 31
Code enhancement 4 34
C# class library debugging - Breakpoint will not hit. 8 34
orderby list (from Json) 1 31
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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 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