[Mono-list] classes "Serialization support " task.
08 Aug 2002 02:13:23 +0800
On Wed, 2002-08-07 at 06:19, Cesar Octavio López Nataren wrote:
> Hello, I looked at the mono:: pending tasks and I found the "Serialization
> support" task. And I wondering what exactly must be done. And I got this
Great, thanks for looking into this.
> - Is there any convention for the serialize and des-serialize methods?
> (you know, where the File, Stream, BinaryFormatter,
> BinaryFormatter.Serialize cycle will go.)
I did some work on the support classes used by the formatters this
spring (the stuff in System.Runtime.Serialization). Right now, the
BinaryFormatter is not yet implemented; I'm not sure if we have the
documentation for the format it uses, maybe it's in the SDK already.
> - Is necessary to implement the ISerializable interface?
Classes that offer custom serialization need to implement the
ISerializable interface. Other classes that only need to be serialized
(no custom serialization) only need the SerializationAttribute.
> - Where can I find some samples (I already looked) in the mono classes?
ISerializable has one method, GetObjectData. Most classes will also
offer a protected constructor that takes the same arguments
(SerializationInfo and StreamingContext) to deserialize.
I did the serialization work for a lot of the Exceptions. To find out
how it gets serialized, Miguel and I wrote a little tool, Serialize.exe.
You can find it in mcs/tools. Compile serialize.cs on windows with csc.
To find out how it works, read this post:
If you need more setup, then edit the source and change
As an example, you can look at the serialized xml for
System.ArgumentException and then look at how GetObjectData and the
serialization ctor is implemented.
Duncan Mak <email@example.com>