views:

81

answers:

1

I am building a class and in the interface for my class(es) I have a property declared

object MyObject { get; set; }

What I want to do is force whatever is stored in MyObject to be serializable. Is there a good way to do this?

Normally, I'd use where : ISerializable, but for serialization you use an attribute, not inheritance, or at least that is my assumption.

A: 

I never could figure out how to enforce a class be Serializable. I had to move away from generic classes anyway for other reasons, so through inheritance I just create a property for my object to be serialized and serialize/deserialize it in the set/get accessors and store the serialized string in a string property in the base class, which is inherited.

Josh