title: Why can't I subtract an int from a uint?
body: <p>I have two variables.  </p>
  
  <pre><code>int x = 1;
  uint y = 2;
  </code></pre>
  
  <p>The types must remain <code>int</code> and <code>uint</code>.  Yet I can't perform basic arithmetic with them.  </p>
  
  <pre><code>y += x;
  </code></pre>
  
  <blockquote>
    <p>Cannot implicitly convert type 'int' to 'uint'. An explicit conversion
    exists (are you missing a cast?)</p>
  </blockquote>
  
  <p>So I have to do something like this everytime?  </p>
  
  <pre><code>if (x &lt; 0)
  {
      y -= (uint)Math.Abs(x);
  }
  else
  {
      y += (uint)x;
  }
  </code></pre>
  
  <p>Coming from a C/C++/Java background, this confuses me.<br>
  Is there something I'm missing here?   </p>
  
  <p>Why is this behavior different from the other languages mentioned?<br>
  Are there better alternatives?  </p>
  
  <p>I assume this is a common trip-up to newcomers of the language.<br>
  No, I'm not relying on underflow.</p>