IAbstract
IAbstract

Reputation: 19881

Serialize ComponentModel.Container?

Is it possible to serialize (binary) a System.ComponentModel.Container?

Upvotes: 2

Views: 430

Answers (2)

Marc Gravell
Marc Gravell

Reputation: 1064114

What is it you actually want to do here? As has been noted, you can't use BinaryFormatter unless the type is serializable, but you would also need to consider all the things that might be contained in the container. They would also need to be serializable.

You can get around the "must be [Serializable]" issue by not using BinaryFormatter, but most other serializers (for example XmlSerializer) would have a problem with not knowing all the subclasses up-front, and things like non-settable properties.

If you have the right .NET versions, you could also consider things like XamlWriter, which may provide some interesting possibilities.

Upvotes: 2

Anton
Anton

Reputation: 5633

No, it is not marked serializable.

Upvotes: 2

Related Questions