title: Trying to cast a boxed int to byte
body: <p>Code to illustrate :</p>
  
  <pre><code>        int i = 5;
          object obj = i;
          byte b = (byte)obj; // X
  </code></pre>
  
  <p>When run, this generates a System.InvalidCastException ("Specified cast is not valid") at line "X". Doing a double cast works : </p>
  
  <pre><code>        byte b = (byte)(int)obj;
  </code></pre>
  
  <p>I would have thought that you ought to be able to cast a boxed int (if it has a value in the range 0..255) to a byte. Can anyone shed any light on this ? </p>
  
  <p>(This is in .net 2.0, in case that matters).</p>