I have the following working code
Main.cs
Bootstrap.csCode:Bootstrap<ROC> boot = new Bootstrap<ROC>(selectedTool as ROC);
Tools.csCode:class Bootstrap<T> where T : class, IBootstrappable { DataTable data; public Bootstrap(T selectedTool) { data = selectedTool.CreateBootstrapDataTable(); }
selectedTool has type ROC in this case, which is a derived class from StatisticalTool. However, the application should work for other derived classes as well.Code:public interface IBootstrappable { DataTable CreateBootstrapDataTable(); }
So I need something like
But this doesn't work. Who has the solution?Code:Type type = selectedTool.GetType(); Bootstrap<type> b = new Bootstrap<type>(selectedTool as type);


Reply With Quote
