A
Aaron Clamage
Hi,
I'm not sure that if this is the right forum, but any help would be greatly
appreciated.
I am porting some java serialization code to c# and I can't figure out the
correct way to do it. It seems that either I can use default serialization
or implement ISerializable. Is there any way to do both (e.g. extend the
default serialization). In other words, I want to be able to implement my
custom serialization code but call the default serialization code as well.
In java, I can do this:
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
//implement my custom code
}
It seems there is no .NET equivalent. In particular I have a class that has
a GraphicsPath member. This class implements ISerializable so that it can
correctly serialize the path. But, for the other members including
references to other objects, I would like to use the default serialization.
Is this possible? Moreover this class derives from a serializable class
that does not implement ISerializable. Does the derived class have to
serialize all of the inherited members as well, if it chooses to do custom
serialization.
Thanks so much,
Aaron
I'm not sure that if this is the right forum, but any help would be greatly
appreciated.
I am porting some java serialization code to c# and I can't figure out the
correct way to do it. It seems that either I can use default serialization
or implement ISerializable. Is there any way to do both (e.g. extend the
default serialization). In other words, I want to be able to implement my
custom serialization code but call the default serialization code as well.
In java, I can do this:
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
//implement my custom code
}
It seems there is no .NET equivalent. In particular I have a class that has
a GraphicsPath member. This class implements ISerializable so that it can
correctly serialize the path. But, for the other members including
references to other objects, I would like to use the default serialization.
Is this possible? Moreover this class derives from a serializable class
that does not implement ISerializable. Does the derived class have to
serialize all of the inherited members as well, if it chooses to do custom
serialization.
Thanks so much,
Aaron