5
Answers

Retrieving Class Type info Using Reflection

Tony Castro

Tony Castro

16y
6.5k
1

Hey all,

I'm having some issues retrieving the Type information of a .dll, using Reflection.  To give some background, I need to dynamically call particular functions within a .dll from a seperate class.  This is a code snippet that I'm using right now:

Type[] types = assembly.GetTypes();

string ClassName = types[0].FullName;

Instance = assembly.CreateInstance(types[0].FullName);

 

This worked just fine, but then I changed the .dll class from this:

class Test {

to

class Test : BasicEngineWrapper.EngineUtilities, BasicEngineWrapper.IEngineWrapper

BasicEngineWrapper.Engine.Utilities is an Abstract Class and BasicEngineWrapper.IEngineWrapper is an interface.

I get an error at: "Type[] types = assembly.GetTypes()", it reads "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information".

 

I've been trying to fix this for quite a while, although I'm not to familiar using Reflection.  Mabye I'm not using these methods correctly, any help would be much appreciated.

 

Tony

 

Answers (5)