Using Powershell to access Static class within a Static Class
It's [Foo.Bar.ParentClass+ChildClass]
. On PowerShell 3 tab completion will tell you as much. Furthermore, you can use Add-Type
to compile and load the code directly:
C:\Users\Joey> add-type 'namespace Foo.Bar>> {>> public static class ParentClass>> {>> public const string myValue = "Can get this value";>>>> public static class ChildClass>> {>> public const string myChildValue = "I want to get this value";>> }>> }>> }'>>C:\Users\Joey> [Foo.Bar.ParentClass+ChildClass]::myChildValueI want to get this value
No need to fiddle around with the C# compiler and [Assembly]::LoadWithPartialName
.