lundi 17 octobre 2016

Getting class instance dynamically

I am trying to create instance of a class in my project. But I can't get it done. I searched stackoverflow and tried many methods but none has worked so far.

My directory structure is something like this:

Root
 Plugins
  AFolder
   AFolder.cs
 Controllers
  MyController

I want to create an instance of the AFolder.cs class in MyController but can't get it done.

I tried:

Object obj = Activator.CreateInstance("Root.Plugins.AFolder", "AFolder");

But this gives error: Could not load file or assembly.





Aucun commentaire:

Enregistrer un commentaire