【发布时间】:2021-02-14 19:55:26
【问题描述】:
我想检查是否存在某种类型。例如:
Add-Type -TypeDefinition '
public class Test{
public static int aaa(){
return 1;
}
}'
[test]::aaa() # 1
[type]::GetType('test') # empty
但 GetType() 不适用于我的“测试”类型。
【问题讨论】:
-
不应该是
[test].GetType()吗? -
我想检查类型是否存在且没有错误信息。 [type]::GetType() 方法还有什么问题?
-
这能回答你的问题吗? How to test a (possible) unknown type?
标签: .net powershell