I have a dropdownlist on a webpage which has list of all classnames , in C# code I need to instantiate object of selected items from dropdownlist and call method of it . All classes have similar methods .
String sCalclationType = "N0059";
var Calculator = Activator.CreateInstance("Calculator", sCalclationType );
var count = Calculator.DoCalculation();
I tried casting which shows "Cannot convert type 'System.Runtime.Remoting.ObjectHandle' to 'CypressDataImport.DiabetesHelper.NQF0059" , Also I need to cast to type which needs to be same as dropdown item so not sure how to do that .
//var calc = (N0059)Calculator;
How do I handle this scenario ?