Consider these two statements:
$result = [bool]$SomeObject $result = if ($SomeObject) { $true } else { $false }
These two statements seem equivalent, but quirks of PowerShell often surprise me. Usually I try to work with similar things from the language specification, but the closest to what seems to be is stackoverflow.
Are the two statements above equivalent for all the possible types and values โโof $SomeObject ?
Is the answer to (1) actually baked in the CLR? If so, how can I say that this is so?
casting powershell if-statement equivalent
alx9r May 6 '15 at 10:41 PM 2015-05-06 10:41 PM
source share