如何访问Add-Type -TypeDefinition "..."
另一个定义的类型Add-Type -TypeDefinition "..."
?
在下面的代码示例中,尽管名称空间相同,但编译器无法找到该UserCode
类型.
Add-Type -TypeDefinition @"
namespace SampleCode {
public struct UserCode {
public string Name;
public string Id;
}
}
"@
#.... do something ....
Add-Type -TypeDefinition @"
namespace SampleCode {
public struct UserInformation {
public UserCode User;
public string Note;
}
}
"@
# => Error ... Add-Type : <temporary source path>(3) : The type or namespace name
# 'UserCode' could not be found (are you missing a using …
Run Code Online (Sandbox Code Playgroud) powershell ×1