title: Bit manipulation in C# using a mask
body: <p>I need a little help with bitmap operations in C#</p>
  
  <p>I want to take a <code>UInt16</code>, isolate an arbitrary number of bits, and set them using another <code>UInt16</code> value.</p>
  
  <p>Example:</p>
  
  <pre><code>10101010  -- Original Value
  00001100  -- Mask - Isolates bits 2 and 3
  
  Input        Output
  00000000  -- 10100010
  00000100  -- 10100110
  00001000  -- 10101010
  00001100  -- 10101110
                   ^^
  </code></pre>