Iterate over static properties of a class

Viewed 527

To access a static method, we use

[namespace.ClassName]::MethodName()

and for static properties we use

[namespace.ClassName]::Property

How do I iterate through all the static properties inside this class?

$list = [namespace.ClassName] | Get-Member -Static -MemberType Property

Returns me a list of all the static properties, but how do I use it, i.e access its value. If I want to pass the variable to a method, how do I do so? $list[0] does not work.

2 Answers
Related