Is there a way to get a Type from string names / types only?

advertisements

I am needing to reference a type in an external assembly. I know the namespace and the type name and I know the assembly will be in the GAC, but that's it. Is there a way to get this type. I see there's a way to get it from a GUID or Program ID which works for me, but I know the people who develop the external assembly may drift away from these COM-like attributes. So, I don't want to depend on them.

Just for a frame of reference, I'd like my software to be very versatile when it comes to this external software being upgraded. So I can't depend on certain versions of assemblies being there for me.


You can load an assembly by name if its in the GAC and then iterate though all its types using Assembly.GetTypes(). You can use loadpartialname but its deprecated to get an assembly with out the fully qualified name.

Look at Assembly.Load()
and Assembly.GetType()