|
-is [System.Management.Automation.PSCustomObject] I do an Import-Csv on a file and get False when using the '-is
[PSCustomObject]' operator the first element .
Should I stick with using .GetType().Name ?
PS > $data = Import-Csv test.csv
PS > $data[0] | gm
TypeName: System.Management.Automation.PSCustomObject
Name MemberType Definition
---- ---------- ----------
Equals Method System.Boolean Equals(Object obj)
GetHashCode Method System.Int32 GetHashCode()
GetType Method System.Type GetType()
ToString Method System.String ToString()
Age NoteProperty System.String Age=1
Name NoteProperty System.String Name=John Doe
PS > $data[0] -is [object]
True
PS > $data[0] -is [System.Management.Automation.PSCustomObject]
False
PS > $data[0].GetType().Name
PSCustomObject
PS > $data[0].GetType().Name -eq "PSCustomObject"
True |