looks like [convert]::ToBoolean will still work, even if your file contains "$false" instead of "False".
Just keep in mind that [bool]"False" is True.
Yes, boolean operations can get overly complicated if you try hard enough to complicate it with things like double-negatives and weird casts. Casting to [bool] does not work intuitively, as it appears to interpret any string other than "" as true.
Not sure about [convert]::ToBoolean, though:
PS M:\> [convert]::ToBoolean('$false')
Exception calling "ToBoolean" with "1" argument(s): "String was not recognized as a valid Boolean."
At line:1 char:1
+ [convert]::ToBoolean('$false')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FormatException
PS M:\> [convert]::ToBoolean("$false")
False
PS M:\> [convert]::ToBoolean($false)
False
PS M:\>
I'd try to avoid casting altogether and change this:
$Private=[bool]$_.Private
to something like this:
$Private = ( $_.Private -eq 'true' )
and then indicate the boolean values in the csv file as 'true' and 'false'. This would be much less likely to throw an error in the event of processing data that has been corrupted. You could be even more paranoid about that possibility by testing for true
and false and throwing an error if it is not one or the other...