В PowerShell вы можете указать тип с помощью квадратных скобок следующим образом:
PS C:\Users\zippy> [int]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int32 System.ValueType
Существуют также встроенные ускорители типов например [xml], который экономит несколько нажатий клавиш, когда вы хотите привести что-то к XmlDocument.
PS C:\Users\zippy> [xml]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False XmlDocument System.Xml.XmlNode
Вы можете сгенерировать список с помощью одной из двух команд:
[type]::gettype("System.Management.Automation.TypeAccelerators")::Get
[psobject].assembly.gettype("System.Management.Automation.TypeAccelerators")::Get
PowerShell 3.0 добавляет оператор с именем [ordered]. Однако это не псевдоним типа.
PS C:\Users\zippy> [ordered]
Unable to find type [ordered]: make sure that the assembly containing this type is loaded.
At line:1 char:1
+ [ordered]
+ ~~~~~~~~~
+ CategoryInfo : InvalidOperation: (ordered:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Однако он может привести Hashtableк OrderedDictionarys.
PS C:\Users\zippy> ([ordered]@{}).GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True OrderedDictionary System.Object
Итак, мой вопрос: если [ordered] не ускоритель типов, то что это такое?