Powershell Tip: Get all overloaded method signatures

Powershell ISE is great for authoring of Powershell scripts, however it does not provide intellisense for object method parameters.
For example, if you type the below code snippet on ISE, you do not get any help regarding the parameters GetDirectories can take as input. It also does not indicate if there are overloads for the same method with varying parameters and types.
Method Signature

For invoking these method, we browse through MSDN documentation to figure out the type and number of parameters. However, in powershell we can use the below method technique to view all the method signatures.

The idea is to execute the method without the parenthesis. When a method is invoked without parenthesis, powershell would use reflection and output all the method signatures.

Method Signature I

Method results

This would help you in knowing which types and overloads to use while invoking the method.

Hope this helps!!



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