Serializer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

When we get generic collections will the serializer change so we dont need
to give it a type parameter for collections ?

Currently today if we serialize an ArrayList, we have to give it a Type
array. If the collection is of a specific type, is this still needed?


Thanks.
 
When we get generics, you will still have to give generics a type
parameter. A generic is not an instantiable type unless it has all of its
type parameters. It is the unique combination of type parameters plus the
generic which make up unique type definition.

Now, when it comes to serialization, it depends on what kind of
serialization you are using. If you are using Xml serialization, then I
imagine you will have to give it the type still, as the container needs to
be constructed, and that can't be done without all of the type parameters
that a generic needs.

With regular serialization (using formatters), this isn't an issue, as
you never have to declare the type, you just have to have an instance of an
object (which follows serialization rules). However, to instantiate an
object, you need to have a complete type definition, so the question becomes
moot.

Hope this helps.
 
Back
Top