Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

Serialization of a Derived Class

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
Lawrence Avery
Asked:
Lawrence Avery
  • 3
  • 3
1 Solution
 
käµfm³d 👽Commented:
What kind of serialization? Binary? XML?
0
 
Lawrence AverySystem DeveloperAuthor Commented:
Binary
0
 
käµfm³d 👽Commented:
Yes, the base class must be marked as Serializable as well.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Lawrence AverySystem DeveloperAuthor Commented:
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
 
käµfm³d 👽Commented:
If you serialize the derived class, you will get an exception stating that the base class needs the attribute as well:

Screenshot
0
 
Lawrence AverySystem DeveloperAuthor Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now