私は2つのコードを持っています:
# code 1:
[type]$t1 = [switch]
# all is ok, code works as expected
#code 2:
function test ([type]$t2) { }
test -t2 [switch]
# here we get error. can't convert from string to system.type
私は知っています、私は書くことができます:test -t2 "System.Management.Automation.SwitchParameter"
、しかしそれは醜いです!! [switch]を[type]variableに設定できるのに、関数に渡せないのはなぜですか?