title: Using ternary operator: "only assignment, call, increment..."
body: <p>I have action dictionary defined as:</p>
  
  <pre><code>var actions = new Dictionary&lt;string, Action&lt;string, string&gt;&gt;();
  </code></pre>
  
  <p>I put there actions like: </p>
  
  <pre><code>actions.Add("default", (value, key) =&gt; result.Compare(value, properties[key], Comparers.SomeComparer, key));
  ...
  </code></pre>
  
  <p>I'm using this code to run it:</p>
  
  <pre><code>if (actions.ContainsKey(pair.Key))
  {
      actions[pair.Key](pair.Value, pair.Key);
  }
  else
  {
      actions[""](pair.Value, pair.Key);
  }
  </code></pre>
  
  <p>It works just fine, but I wanted to use '?' notation to make it shorter:</p>
  
  <pre><code>actions.ContainsKey(pair.Key) ? actions[pair.Key](pair.Value, pair.Key) : actions[""](pair.Value, pair.Key);
  </code></pre>
  
  <p>This code shows me error:</p>
  
  <blockquote>
    <p>Error 1   Only assignment, call, increment, decrement, and new object
    expressions can be used as a
    statement</p>
  </blockquote>
  
  <p><code>actions[pair.Key](pair.Value, pair.Key)</code> <strong>isn't it a call?</strong> Am I missing something? Is it possible to use '?' notation with action dictionaries? I was trying to find something about that but it's hard to find anything about '?' operator and this error because '?' is ignored by google.</p>