GetType问题 [英] GetType problem
本文介绍了GetType问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Assmply类中遇到GetType方法问题.
I have a problem with GetType Method in Assmply class.
System.Reflection.Assembly s = System.Reflection.Assembly.Load("myDll");
Type t = s.GetType("MyNameSpace.MyClassName.MyEnum");
当我尝试获取MyEnum的类型时,它返回"null",但是当枚举直接在有效的命名空间中(而不是在类中)起作用时,但我需要将枚举放在readablity
When I try to get the type of MyEnum it returns "null", but when the enum is in the namespace directly (not in the class) that works, but I need for the enum to be in the class for the readablity
推荐答案
这是内部类型的语法:
Type t = s.GetType("MyNameSpace.MyClassName+MyEnum");
This is the syntax for inner types:
Type t = s.GetType("MyNameSpace.MyClassName+MyEnum");
这篇关于GetType问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文