title: PowerShell Add-Type not behaving as expected
body: <p>Can anyone explain why the following (using the <code>System</code> namespace qualifer) works:</p>
  
  <pre><code>Add-Type @"
  public class BitValueChecker
  {
      public static bool IsBitSetZeroBased(uint value, uint bitNumber)
      {
          if (bitNumber &lt; 0 || bitNumber &gt;= 32)
              throw new System.Exception("Invalid bit number must be &gt;= 0 and &lt;= 31");
  
          uint checkValue = value &amp; System.Convert.ToUInt32(System.Math.Pow(2, bitNumber));
          return checkValue &gt; 0;
      }
  }
  "@
  </code></pre>
  
  <p>while the below (essentially identical) snippet causes PS to complain that <code>Exception</code>, <code>Convert</code> and <code>Math</code> "do not exist in the current context"?</p>
  
  <pre><code>Add-Type @"
  public class BitValueChecker
  {
      public static bool IsBitSetZeroBased(uint value, uint bitNumber)
      {
          if (bitNumber &lt; 0 || bitNumber &gt;= 32)
              throw new Exception("Invalid bit number must be &gt;= 0 and &lt;= 31");
  
          uint checkValue = value &amp; Convert.ToUInt32(Math.Pow(2, bitNumber));
          return checkValue &gt; 0;
      }
  }
  "@
  </code></pre>