title: BitShifting for uint in c#
body: <p>If I want to convert 4 bytes into an int, I can do this:</p>
  
  <pre><code>        byte[] b = BitConverter.GetBytes(i1);
          int i2 = BitConverter.ToInt32(b,0);
          int i3 = b[0] | (b[1]&lt;&lt;8) | (b[2]&lt;&lt;16) | (b[3]&lt;&lt;24);
  </code></pre>
  
  <p>and then i1,i2,i3 will all equal.</p>
  
  <p>but how do I do the same for a uint? This:</p>
  
  <pre><code>        uint u1 = uint.MaxValue-1000;
          byte[] b = BitConverter.GetBytes(u1);
          uint u2 = BitConverter.ToUInt32(b,0);
          uint u3 = (uint)(b[0] | (b[1]&lt;&lt;8) | (b[2]&lt;&lt;16) | (b[3]&lt;&lt;24));
  </code></pre>
  
  <p>results in a overlflow for large uints.</p>