Reflection with unknown assembly?
Posted on 2004-10-04
I'm working with System.Reflection. So far it works nicely for dll's, like to invoke a static method:
Assembly assembly = Assembly.LoadFrom(dllName);
System.Type type = assembly.getType(className);
MethodInfo method = type.GetMethod(mName,types); // types are the types of parameters I'm using
Object myObj = method.Invoke(null,myParams);
What do I do though, if I want to call a method of a class not in that dll, but say, for example, in System.IO? That is, I'm calling this reflection method from a different program, and I can specify that I want to use method "getFiles()" in class "Directory" or even class "System.IO.Directory". But of course I don't specify the assembly to use.
Is there a way to do that? Hope my question is clear, if not, please ask...