Deserialization and changed namespace name

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

We're trying to move our class the does the serialization and
deserialization to a separate class library. When deserializing the class
the binaryformatter complains about unable to resolve type. I also tried
leaving the namespace the same as before just moving the class to a
different library but I get the same error.

Is there a way I can convert the type?
 
Joe,

Take a look at the BindToType method on the SerializationBinder instance
returned to you from the Binder property on the IFormatter implementation.
It should allow you to indicate that one type should be substituted for
another.

Also, you can create your own serialization surrogate which will allow
you to do intercept the serialization calls, and perform whatever you need
to do.

Hope this helps.
 
The Binder worked out perfect.

Thanks!

Nicholas Paldino said:
Joe,

Take a look at the BindToType method on the SerializationBinder
instance returned to you from the Binder property on the IFormatter
implementation. It should allow you to indicate that one type should be
substituted for another.

Also, you can create your own serialization surrogate which will allow
you to do intercept the serialization calls, and perform whatever you need
to do.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Joe said:
We're trying to move our class the does the serialization and
deserialization to a separate class library. When deserializing the class
the binaryformatter complains about unable to resolve type. I also tried
leaving the namespace the same as before just moving the class to a
different library but I get the same error.

Is there a way I can convert the type?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top