Intellisense / get-member in Powershell

One of the neat tricks is write out what Methods, Properties get-member cmdlet.  Here are a couple of replies I recently from my question in the Powershell newsgroup.  

Example 1
————-
It works well for static methods (note the parenthesis and square brackets
around the class name):

PS> get-member -in ([system.math]) -static

Example 2
————-
You don't need to assign to a variable. You can pipe the new object into the get-member call:

new-object text.stringBuilder | get-member -memberType methods

If you don't want to create an instance at all, you can use reflection:

[text.stringBuilder].getMethods() | % { $_.name } | sort -unique

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s