You can pass the Type
Fullname
Type type = Type.GetType("System.Windows.Forms.Label");
This will create the type and to create the instance of object u can use Activator.CreateInstance
object obj = Activator.CreateInstance(type);
Working with Type
loaded in AppDomain.CurrentDomain.GetAssemblies()
private void btnAddDymanicLabel_Click(object sender, EventArgs e)
{
Type type = GetTypeNameFromDomain("System.Windows.Forms.Label");
Label lbl = (Label) Activator.CreateInstance(type);
this.Controls.Add(lbl);
lbl.Text = "dynamic created control";
}
private Type GetTypeNameFromDomain(string typename)
{
return AppDomain.CurrentDomain.GetAssemblies().SelectMany(assembly => assembly.GetTypes().Where(type => type.FullName == typename)).FirstOrDefault();
}
A simple example :
static void Main(string[] args)
{
Type type = Type.GetType("System.Int32");
object obj = Activator.CreateInstance(type);
int num = (int) obj;
num = 10;
Console.WriteLine(num); // prints : 10
}