Powershell Tip: get all Constructor overloads and their signatures

In continuation to the previous post on getting all overload signature of an object’s method, you would notice that we do not get any help regarding the number and overload for an type’s constructor. To view the overloads of a type constructor, below script can be used.

Const1

The above can also be re-written more succinctly using pipelines as shown below..

Const2

the results should look like below..

Const result

This would help you in knowing which constructor to use while creating new objects of a type.

Hope this helps!!

Cheers!!

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!!

Cheers!!