For example, you can use a
Dictionary
that gives the type you want from the string, and then instanciate the type:
Dictionary<string, Type> types = new Dictionary<string, Type>();
types["UserControl1"] = typeof(UserControl1);
types["UserControl2"] = typeof(UserControl2);
types["UserControl3"] = typeof(UserControl3);
To instanciate the type from the string:
UserControl InstanciateMyUserControl(string className)
{
return types[className].InvokeMember(null, System.Reflection.BindingFlags.CreateInstance, null, null, null) as UserControl;
}