How to initialize one class from a library?
Posted
by daemonsvk
on Stack Overflow
See other posts from Stack Overflow
or by daemonsvk
Published on 2010-06-18T15:29:51Z
Indexed on
2010/06/18
15:33 UTC
Read the original article
Hit count: 220
Hi, I have a few classes in the class library (separate assembly). I referenced it to my project and I want to initialize one specific class from that library. I know only its name. All of the classes implements one interface. And here comes the problem.
My code so far:
using MyLibrary;
...
IMyInterface dll = Activator.CreateInstance("MyLibrary", "MyLibrary.NameOfClass") as IMyInterface;
But dll is always null. Any ideas?
Thanks
© Stack Overflow or respective owner