You'll need to create a Type object from the $Class string argument:
$script = {
Param(
[Parameter(Mandatory=$True)]
[string]$class
)
([Type]$Class).GetConstructors() |
ForEach-Object {
($_.GetParameters() |
ForEach-Object {
‘{0} {1}’ -f $_.Name, $_.ParameterType.FullName
}) -join ‘,’
}
}
&$script 'system.io.streamwriter'
stream System.IO.Stream
stream System.IO.Stream,encoding System.Text.Encoding
stream System.IO.Stream,encoding System.Text.Encoding,bufferSize System.Int32
stream System.IO.Stream,encoding System.Text.Encoding,bufferSize System.Int32,leaveOpen System.Boolean
path System.String
path System.String,append System.Boolean
path System.String,append System.Boolean,encoding System.Text.Encoding
path System.String,append System.Boolean,encoding System.Text.Encoding,bufferSize System.Int32