I had a problem trying to reference a struct inside a public class from PowerShell. I tried to do it just like in C#, only with PowerShell syntax, simply adding the nested class or struct in the namespace, separated by a dot.
$myProperty = [MyProject.MyClass.MyClassStruct]::MyProperty
But this didn’t work. Instead I got the following error:
“Unable to find type [MyProject.MyClass.MyClassStruct]: make sure that the assembly containing this type is loaded.”
It seems, after fiddling around a bit and doing a quick search, that PowerShell has it’s very own way of calling a nested class or struct. Instead of adding the nested class with a dot, you actually have to use a +, like this:
$myProperty = [MyProject.MyClass+MyClassStruct]::MyProperty
I don’t know why, but that’s the way you do it. =)