title: Why is it not possible to assign a string to a strongly typed boolean variable?
body: <p>Let's say I try to assign a string to a strongly typed integer variable:</p>
  
  <pre><code>[int]$bar = '1'
  </code></pre>
  
  <p>This works, as PowerShell is able to cast the string <code>'1'</code> to an integer.</p>
  
  <p>Now things are different if I attempt the same with a strongly typed boolean variable:</p>
  
  <pre><code>[boolean]$foo = 'foo'
  Cannot convert value "System.String" to type "System.Boolean". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 
  or 0.
  </code></pre>
  
  <p>I find this confusing, as PowerShell at the same time allows an explicit cast from string to boolean:</p>
  
  <pre><code>[boolean]'foo'
  True
  </code></pre>
  
  <p>Does anyone know the reason for this seemingly inconsistent behavior?</p>