Dynamically Loading a DLL
Posted
by TooFat
on Stack Overflow
See other posts from Stack Overflow
or by TooFat
Published on 2010-04-16T14:53:17Z
Indexed on
2010/04/16
15:03 UTC
Read the original article
Hit count: 223
c#
I am trying to simply load a dll written in C# at run time and create an instance of a class in that dll.
Assembly a = Assembly.LoadFrom(@"C:\Development\DaDll.dll");
Type type = a.GetType("FileReleaseHandler", true);
TestInterface.INeeedHelp handler = Activator.CreateInstance(type) as TestInterface.INeeedHelp;
No errors are thrown, and if I step through the code I can walk though the FileReleaseHandler Class as it executes the constructor but the value of handler is always null.
What am I missing here? or even is there a better way I should be going about this?
© Stack Overflow or respective owner