Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a class MyForm : System.Windows.Forms.Form which I have marked as Serializable and I made implement ISerializable. It contains one instance of a class MyPanel : System.Windows.Forms.Panel, also implementing ISerializable. There is one more level of containment, as the MyPanel class contains one instance of a class MyPicBox : System.Windows.Forms.PictureBox (also implementing ISerializable).

 

So containment is illustrated by�

MyForm > MyPanel > MyPicBox

 

The instance of MyPicBox contains a string and an Image which I want to serialize. How do I do this? I know the specifics that are common to a normal serialization process (like using a formatter). It�s the hierarchal containment that is confusing me. The serialization process must start in MyForm, even though there is really nothing to serialize until we burrow down into MyPicBox. I can�t just stick the [serializable] attribute on each class and let if fly because they inherit from nonserializable base classes of the Framework. If you have any insight I would greatly appreciate your advice. Thanks!

 

Collin Lourie

  • Administrators
Posted

How are you implementing ISerializable in each of the classes?

If the MyPicBox implements ISerializable then you should be able to call it's implementation from the MyPanel's implementation to simply delegate the task down to the nested members.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...