# encoding: ascii
# api: powershell
# title: Get-Constructor
# description: Enumerates the constructors of a type with the parameters that they take, so you can figure out what your options are when calling New-Object.
# version: 0.1
# type: function
# author: Joel Bennett
# license: CC0
# function: Get-Constructor
# x-poshcode-id: 1368
# x-archived: 2017-02-27T18:39:29
# x-published: 2010-10-04T20:44:00
#
#
function Get-Constructor {
PARAM( [Type]$type )
$type.GetConstructors() |
Format-Table @{
l="$($type.Name) Constructors"
e={ ($_.GetParameters() | % { $_.ToString() }) -Join ", " }
}
}
Set-Alias gctor Get-Constructor