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
次の2つのコマンドのいずれかを使用してリストを生成できます。
- PS v2.0
[type]::gettype("System.Management.Automation.TypeAccelerators")::Get
- PS v3.0
[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をOrderedDictionaryにキャストすることはできます。
PS C:\Users\zippy> ([ordered]@{}).GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True OrderedDictionary System.Object
だから私の質問は、[注文済み]がタイプアクセラレータではない場合、それは何ですか?