How to instantiate a type dynamically using reflection?

前端 未结 3 394
抹茶落季
抹茶落季 2021-02-03 23:25

I need to instatiate a C# type dynamically, using reflection. Here is my scenario: I am writing a base class, which will need to instantiate a certain object as a part of its in

3条回答
  •  难免孤独
    2021-02-04 00:07

    Try Activator.CreateInstance(Type)

    http://msdn.microsoft.com/en-us/library/wccyzw83.aspx

提交回复
热议问题