GetTypeメソッドを使う。終わりのほうの例のとおり、配列であることも確認でき、個々の要素の型も調べることができる。
PS > $n = 1 PS > $n.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Int32 System.ValueType PS > $d = 2.3 PS > $n.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Int32 System.ValueType PS > $n = 1 PS > $n.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Int32 System.ValueType PS > $d = 2.3 PS > $d.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Double System.ValueType PS > $s = "鈴木みのり" PS > $s.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object PS > $s = "鈴木みのり", "セナディア" PS > $s.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Object[] System.Array PS > $s[0].GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object