When using PowerShell, sometimes we compare objects of different types. The usual scenario $int -eq $bool(i.e., where 0 -eq $false, 0 -ne $trueand any non-zero value are true, but not false).
This is basically a good thing; sometimes it’s a pain (for example, if I look for all the properties of an object that has a value 1, but I do not want all those who have a value $true).
Question
Is there an operator that performs this comparison without conversion; those. which essentially does the same as the javascript identification operator ( ===) ;?
Bonus Question
If there is such an operator, is there a tolerance? that is, although I do not want to treat 1and truehow to identity, it would (sometimes) be helpful if I could be seen [int]1, and [long]1as if they were.
source
share