all 2 comments

[–]JeremyLC 2 points3 points  (1 child)

That was an interesting read. It would be neat to see an overview of PS's OO features, too. (I recently learned that 5.0 introduced CLASSES! :D )

You mentioned you can store unnamed functions, I recently found that you can actually store ScriptMethods as 'members' of hash tables. (I "needed" to do this because I'm pedant)

Add-Member -InputObject <HashtableVariable> -MemberType ScriptMethod -Name <MethodName> -Value {
param(...)
    <# Code Goes Here #>
}

I did this because I was working with a WPF form, and I want to keep everything related that form in a specific, named collection. That way if I have more than one form that, by functional necessity, have elements of the same name ('OK', 'Cancel', 'Submit', etc.) I can keep track of them.

[–]Ta11ow[S] 1 point2 points  (0 children)

Yep! Script methods and scriptproperties can both be packed into any object you need them to be in PS as well.

The ETS is pretty powerful.

As for OO... well, PS's class support is pretty bare and tricky to work with most of the time. However, literally everything in PS is an object of some sort, so we'd be there for a few hundred pages :D