Getting a System.Type from type's partial name

前端 未结 7 843
梦谈多话
梦谈多话 2020-11-27 07:18

I want to get a System.Type given only the type name in a string.

For instance, if I have an object:

MyClass abc = new MyCl         


        
7条回答
  •  一向
    一向 (楼主)
    2020-11-27 07:44

    Type type = Type.GetType("foo.bar.MyClass, foo.bar");
    

    MSDN. Make sure the name is Assembly Qualified.

提交回复
热议问题