By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,185 Members | 1,420 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,185 IT Pros & Developers. It's quick & easy.

Forcing re-serialization of a serialized object?

P: n/a

The result of auto-converting some Java code to C# yielded
the following upgrade issue regarding the original Java
call to "reset()":

public virtual void writeObj(Object obj)
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(thisStream, obj);

Method '' was not
converted. 'ms-


At the bottom of this posting I have copied what the
Microsoft help on this issue provided. While I understand
what the problem is (that already serialized objects won't
be reserialized), I don't understand what they're saying
to do to correct the error. I looked at their two
solutions but didn't have a clue what the words meant. Is
there a simple way to force reserialization of the same

Ray Mitchell
******FROM Microsoft's help link:

In Visual J++, this method sets the state of the
ObjectOutputStream object to the same state as when it was
created. As objects are serialized to the stream, the
ObjectOutputStream remembers which ones are already
serialized. If the program requests that already
serialized objects be written again, ObjectOutputStream
writes a reference to the previous object. Calling this
method causes ObjectOutputStream to serialize all
subsequent objects fully.

In the .NET Framework, there is no direct equivalent.

To correct this error

Use the
System.Runtime.Serialization.Formatters.BinaryForm atter.Bin
der property or the BinaryFormatter.Context property with
the source and destination of a serialized stream.
Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.