Really awesome article! Just curious when getting a data type why:
$var = 1
$var | Get-Member
Instead of:
$var = 1
$var.GetType()
The latter, to me at least, more resembles the Python equivalent. Get-Member does a lot more than to just the get the type of the object. It also pulls the methods and properties available to that object.
The pipe "unrolls" collections that are input (iterates over the elements). This means that Get-Member is working on the members in an array, where as .GetType() is working on the array. eg:
5
u/azjunglist05 Sep 17 '20
Really awesome article! Just curious when getting a data type why:
Instead of:
The latter, to me at least, more resembles the Python equivalent. Get-Member does a lot more than to just the get the type of the object. It also pulls the methods and properties available to that object.