Hi,
If there is an object in which every public property must be serialized and properties are simple (just numbers or strings or objects already implementing ISerializable
), is there an easy way to do it without having to create GetObjectData(SerializationInfo info, StreamingContext context)
and a constructor taking SerializationInfo
as argument every time?
I know that it can be done manually with reflection, but is there a magic method inside the .NET Framework to do it?
So the correct answer is:
Don't try to implement ISerializable - it is for custom serialization. Instead add the [Serializable] attribute right before your class declaration.