Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Type t = Type.GetType("BLL.MyLayers.TestLayer,BLL");
对于泛型类,t 始终为 null。
当我尝试获取普通类的类型时,t 不为空。
为什么会这样或者我有什么问题?
泛型类型是使用一个小技巧编译的:
class A<T> { } var aa = Type.GetType("ConsoleApplication1.A`1");
请注意,撇号不是引号,而是 1 键左侧的键(在大多数键盘上)。
你可以试试:
Type t = Type.GetType("BLL.MyLayers.TestLayer`1,BLL");