title: How to solve Operator '!=' cannot be applied to operands of type 'T' and 'T'
body: <p>This code snippet works as expected for the <code>int</code> type:</p>
  
  <pre><code>public class Test 
  {
      public int Value
      {
          get =&gt; _Value;
          set
          {
              if (_Value != value)
                  _Value = value;
          }
      }
      private int _Value;
  }
  </code></pre>
  
  <p>When <code>int</code> is replaced by the generic <code>T</code>, the compiler complains with:</p>
  
  <blockquote>
    <p>Operator '!=' cannot be applied to operands of type 'T' and 'T'</p>
  </blockquote>
  
  <p>Why does this happen and is there a way to solve it?</p>