title: If Then Else Shorthand Won't Work Without Assignment
body: <p>In C#, I am trying to shorten some of my return code. What I want to do is something like </p>
  
  <pre><code>condition ? return here:return there;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>condition ?? return here;
  </code></pre>
  
  <p>I am having some issues though, the compiler says the expression is not valid.  Here is an example:</p>
  
  <pre><code>        int i = 1;
          int a = 2;
          i &lt; a ? i++ : a++;
  </code></pre>
  
  <p>This is not valid. However,</p>
  
  <pre><code>        int i = 1;
          int a = 2;
          int s = i &lt; a ? i++ : a++;
  </code></pre>
  
  <p>is valid. Must there be assignment to use this shorthand notation? The only way I can think of using this at the moment is:</p>
  
  <pre><code>int acceptReturn = boolCondition ? return toThisPlace() : 0 ;
  </code></pre>
  
  <p>I would really like that line of code to look more like:</p>
  
  <pre><code>boolCondition ? return toThisPlace():;
  </code></pre>
  
  <p>Which is not valid but is what I am after.</p>