title: Null-conditional operator and !=
body: <p>With the introduction of <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-conditional-operators" rel="noreferrer">Null-Conditional Operators</a> in C#, for the following evaluation,</p>
  
  <pre><code>if (instance != null &amp;&amp; instance.Val != 0)
  </code></pre>
  
  <p>If I rewrite it this way,</p>
  
  <pre><code>if (instance?.Val != 0)  
  </code></pre>
  
  <p>it will be evaluated to <strong>true</strong> if instance is a null reference; It behaves like</p>
  
  <pre><code>if (instance == null || instance.Val != 0)
  </code></pre>
  
  <p>So what is the right way to rewrite the evaluation using this new syntax?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p><code>instance</code> is a field of a big object which is deserialized from JSON. There are quite a few pieces of code like this, first check if the field is in the JSON, if it is, check if the Val property does NOT equal to a constant, only both conditions are true, do some operation. </p>
  
  <p>The code itself can be refactored to make the logical flow more "making sense" as indicated by Peter in his comment, though in this question I am interested in how to use <code>null-conditional operators</code> with <code>!=</code>.  </p>