I would like to create a new instance of the controller through the string name. In classic ASP, I would do eval, but how to do it in C #?
eg:
If I wanted to create an instance of "AccountController", I would usually write:
var Acc = new AccountController();
Now, if the controller name is only available as a string, how can I instantiate an object?
eg,
var controllerName = "AccountController";
var acc = new eval(controllerName)();
Thanks for the help!
Franc
frank source
share