Deserialization to in-place objects - possible?

  • Thread starter Thread starter Craig Bryant
  • Start date Start date
C

Craig Bryant

I have a need to be able to use the .Net serialization services to restore
state to an existing object (and its referenced and contained objects). I
have read about custom serialization, and serialization surrogates, but
these dont seem to allow me to take the object state read in from a
serialization formatter, and apply it to existing objects. They all seem to
work on new objects. If I could just interrupt the part of deserialization
where a new instance of a type is created and the "serialization
constructor" is called, and instead call a member on an existing object, I
think I could do what I want to do.

Does anyone have any idea how I might accomplish this with .Net
serialization?
 
Craig Bryant said:
I have a need to be able to use the .Net serialization services to restore
state to an existing object (and its referenced and contained objects). I
have read about custom serialization, and serialization surrogates, but
these dont seem to allow me to take the object state read in from a
serialization formatter, and apply it to existing objects. They all seem to
work on new objects. If I could just interrupt the part of deserialization
where a new instance of a type is created and the "serialization
constructor" is called, and instead call a member on an existing object, I
think I could do what I want to do.

Does anyone have any idea how I might accomplish this with .Net
serialization?

Well, you can implement IXmlSerializer to do this.
 
Back
Top