Show-Constructor.ps1


<#PSScriptInfo
 
.VERSION 0.0.0.1
 
.GUID b4eb4465-e15c-48aa-86a5-4a285ecbf4e1
 
.AUTHOR Jeffrey Snover
 
.COMPANYNAME
 
.COPYRIGHT
 
.TAGS PSEdition_Core
 
.LICENSEURI
 
.PROJECTURI
 
.ICONURI
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
 
 
.PRIVATEDATA
 
#>


<#
 
.DESCRIPTION
 Display the constructors for a given type
 
#>
 

param ([type]$Type, [Switch]$FullName)

foreach ($c in $Type.GetConstructors())
{
    $Type.Name + “(“
    foreach ($p in $c.GetParameters())
    {
            if ($fullName)
            {
                “`t{0} {1},” -f $p.ParameterType.FullName, $p.Name 
            }else
            {
                “`t{0} {1},” -f $p.ParameterType.Name, $p.Name 
            }
    }
    “)”
}