Results 1 to 3 of 3

Thread: [RESOLVED] (2005) Serialization, interfaces, and unavailable classes

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Resolved [RESOLVED] (2005) Serialization, interfaces, and unavailable classes

    I have a fairly complex class structure and I want to serialize some of it to a file. Some of the classes to be serialized are loaded at runtime from external plugins (all of them implement my IDocumentContent interface). What I want to know is: if I serialize a IDocumentContent plugin that has members that are not from the IDocumentContent interface (i.e. plugin specific settings, etc.) are those serialized as well?

    The second question is this: Can the data is deserialized onto a machine with IDocumentContent interface, but not the plugin that created it (with its own data)?

    Last question, if so, if the data is again re-serialized, will the plugin specific data remain so that it can be deserialized onto the original machine with the plugin?

    Unfortunatly, I'm not at a stage where I can test this. I need to design around the answers to this. Should the IDocumentContent inferface include a PluginSpecificData property of type ISerializable?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: (2005) Serialization, interfaces, and unavailable classes

    You know what? You are at the stage where you can test this. You simply create a couple of new projects, an interface with a one member and a class that implements that interface with an additional member. I know what I think the answers to your questions are but I don't know for a fact, so that's how I would find out for myself. It would take about 30 minutes.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: (2005) Serialization, interfaces, and unavailable classes

    OK... after numerous tests, serializing something derived from interface IDocumentContent that has extra members ALWAYS causes those extra members to be serialized. (It was what I needed...)

    Second question is No. The plugin must exist for the data to be deserialized at all.

    Third question is moot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width