Serialization between assemblies?

  • Thread starter Thread starter Ray Mitchell
  • Start date Start date
R

Ray Mitchell

Hello,

I am currently doing default serialization of various objects and I am aware
that the simplest way to do serialization between assemblies is to put the
objects to be serialized in a common assembly. However, I would like to be
able to put these objects in separate assemblies, but beyond that, continue
doing default serialization. My rough understanding of what I must do is to
implement the ISerializable interface for such objects and (apparently) use
it to change the assembly information. I have read Jeffrey Richter's series
of articles (http://msdn.microsoft.com/msdnmag/issues/02/07/net) concerning
custom serialization but they appear to go way beyond what I want to do (and
can comprehend) at this point. Can someone possibly provide an example of
what I need to do, or point me in the right direction?

Thanks,
Ray Mitchell
 
You can exchange instances of types to|from|between|through|among different
assemblies without serialization as long as the assemblies are in the same
application domain. Whether or not they's in the same assembly is mainly
orthogonal to serialization, although it might simplify your versioning
story. Also - you don't need to implement ISerializable - in most cases you
can just attribute your type with [Serializable]. What is it you're trying
to accomplish?
 
My current application transfers arbitrary object graphs of all different
types over an IP network. Some of the IP nodes are threads within the same
assembly while others are on remote machines. As it is now all of my remote
and local nodes have to at least have the assembly containing the serialized
object in common because of the assembly naming problem. I'd like to be
able to treat the remote assembly as an entirely separate entity.

Mickey Williams said:
You can exchange instances of types to|from|between|through|among different
assemblies without serialization as long as the assemblies are in the same
application domain. Whether or not they's in the same assembly is mainly
orthogonal to serialization, although it might simplify your versioning
story. Also - you don't need to implement ISerializable - in most cases you
can just attribute your type with [Serializable]. What is it you're trying
to accomplish?

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com



Ray Mitchell said:
Hello,

I am currently doing default serialization of various objects and I am aware
that the simplest way to do serialization between assemblies is to put the
objects to be serialized in a common assembly. However, I would like to be
able to put these objects in separate assemblies, but beyond that, continue
doing default serialization. My rough understanding of what I must do
is
to
implement the ISerializable interface for such objects and (apparently) use
it to change the assembly information. I have read Jeffrey Richter's series
of articles (http://msdn.microsoft.com/msdnmag/issues/02/07/net) concerning
custom serialization but they appear to go way beyond what I want to do (and
can comprehend) at this point. Can someone possibly provide an example of
what I need to do, or point me in the right direction?

Thanks,
Ray Mitchell
 
Back
Top