For your solution, instead of passing the object around everywhere, you
should be getting the object from a well-known place, like a static
property on a class. Then, if you serialize/deserialize the member, you
can just discard what you were returning, and return your new instance.
Of course, this means that you have to patch up all of the calls on the
object reference that you have to reference the new well-known location,
and to not store references to the object.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Atmapuri said:
Hi!
<g> Not really. The problem is that if I replace the object that I
deserialize, the rest of my application does not update the
pointers to it and continues to reference the old version.
Therefore, I hope that there is a way to deserialize an object in such a
way that it wont break the links.
For example, if you save the state of an application as a configuration
file using serialization, deserializing core objects in to new instances,
makes it very very difficult to update the links to those objects within
your app.
In extrem case you would have to specifiy at the command line, which
configuration file to use... instead of selecting from the menu, Load
settings..
Thanks!
Atmapuri