How to access a type defined by Add-Type -TypeDefinition "..."
in another Add-Type -TypeDefinition "..."
?
In the following code example, in spite of the same namespace, a compiler cannot find the UserCode
type.
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 directive or an assembly
# reference?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With