Question

I have an MDI application with a treeview control docked to the left and five classes containing the information of the tree nodes i.e Editors for that kind of node.

  • How should I serialize the application such that all the objects are serialized into a single binary file?

  • How to store my resources in it so a single file can be sent to all the machines?

Thanks.

Was it helpful?

Solution

If you wish to serialize multiple objects into one file, just simply combine them all into one object.

For example, you have a lot of objects need to serialize like these:

Teacher t = new Teacher();

Student[] students = new Student[] { ... };

Tool blackboard = new Tool();

...

And all of these objects should be serializable.

You can create a container to contain those object, and serialize it.

[Serializable]
class School
{
    Teacher t;

    Student[] students;

    Tool blackboard;
}

Now, you just need to serialize the school object into one binary file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top