Код: Выделить всё
[pscustomobject]$hashtable
Код: Выделить всё
using System.Collections;
using System.Management.Automation;
[Cmdlet(VerbsData.Out,"PsCustomObject")]
public class OutPsCustomObjectCommand : PSCmdlet {
[Parameter(Mandatory = true)]
public Hashtable Hashtable { get; set; }
protected override void ProcessRecord() {
WriteObject(new PSCustomObject(Hashtable));
}
}
Я думал, что новый psobject () может быть эквивалентным, но writebject (new psobject (hashtable) достаточно отличается от [pscustomobject] $. Консоль: < /p>
Код: Выделить всё
PS\> Out-PsCustomObject -Hashtable @{ a='aye' }
Name Value
---- -----
a aye
PS\> [pscustomobject]@{ a = 'aye' }
a
-
aye
Подробнее здесь: https://stackoverflow.com/questions/794 ... led-cmdlet
Мобильная версия