我想将自定义类型的参数传递给我的 cmdlet。我声明这样的参数:
[Parameter(Position = 1)]
public StoreIdParameter Identity { get; set; }
但是当我使用参数运行 cmdlet 时(例如:Get-Store VS),我得到一个异常:
无法绑定参数“身份”。无法将“System.String”类型的“VS”值转换为“R.Management.StoreIdParameter”类型。
我创建了 StoreIdParameter 的构造函数,它接受 String 但没有帮助。它应该是从字符串到我的类型的某种类型转换器吗?