GetType problem

  • Thread starter Thread starter Ron M. Newman
  • Start date Start date
R

Ron M. Newman

Hi,

I have a certain assembly that needs to create instances of objects where
the object class is passed as a string (e.g. "System.Drawing.Bitmap"). I
have found that calling "GetType" on this string, returns null.

Naturally, I suspect that because the this assembly doesn't reference the
assembly containing "System.Drawing.Bitmap", the type cannot be found and
thus I'm getting null in the GetType.

My question is, how would I solve this. I thoughtof extending my classes so
that assembly references can be given from an outside source and the type
sought there by local GetType.

My question is how do I achieve that? Is there a "GetType" for an assembly?

ron
 
Ron,
My question is how do I achieve that? Is there a "GetType" for an assembly?

There's System.Assembly.GetType if that's what you're looking for.


Mattias
 
I already found the app domain which I query for runtime assemblies and for
each of those I do a "GetType" until I get what I need.

thanks
Ron
 
Ron M. Newman said:
I have a certain assembly that needs to create instances of objects where
the object class is passed as a string (e.g. "System.Drawing.Bitmap"). I
have found that calling "GetType" on this string, returns null.

Naturally, I suspect that because the this assembly doesn't reference the
assembly containing "System.Drawing.Bitmap", the type cannot be found and
thus I'm getting null in the GetType.

I know you've got the answer now, but it's got nothing to do with
referenced assemblies. Unless you include the full assembly name in the
call to Type.GetType, only the current assembly and mscorlib are
searched.
 
Back
Top