Get-Constructor (modification of post by view diff)
View followups from Joel Bennett and Joel Bennett | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1368"></script>download | new post
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.
- function Get-Constructor {
- PARAM( [Type]$type )
- $type.GetConstructors() |
- Format-Table @{
- l="$($type.Name) Constructors"
- e={ ($_.GetParameters() | % { $_.ToString() }) -Join ", " }
- }
- }
- Set-Alias gctor Get-Constructor
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository