Here is the scenario. I have a bunch of UserControls that all inherit from MyBaseControl. I would like to instantiate a UserControl based on its name. For instance:
void foo(string NameOfControl) {
MyBaseControl ctl = null;
ctl = CreateObject(NameOfControl); // I am making stuff up here,
// CreateObject does not exist
}
How do i instantiate this UserControl based on its name. I could have a gigantic switch statement and that smells bad. All the UserControls, including their Base class, are in the same project and all have the same namespace.