Home All Groups Group Topic Archive Search About

Activator CreateInstance in IFormatter implementation

Author
27 Jan 2006 10:32 AM
Rob.J.White
I'm currently trying to create a fairly simple implementation of
IFormatter to use in a project that will allow for cross version
compatibility.

I have built the implementation in such a way that if the object it is
serializing is not in the same assembly then it is treated as version
specific, but anything inside the assembly is considered to be version
independent.

I have the serialization side complete (subject to some through
testing), but when it comes to the de-serialize side I'm a little
stuck.

I intend to use the FieldInfo object to populate a target object's
fields, but I can't populate an object until I've created an instance
of it.

This is all well and good, but how do I decided which constructor I
call? Surely I can't enforce the requirement that the objects I
serialize have a default constructor, that won't work for types that
have system types that need more complex constructors, for example
strings.

Is there a way that I can have an object instance created for me
without doing a lot of work to implement constructor intelligence?

Thanks for any help.
Rob

AddThis Social Bookmark Button