title: Why is ReferenceEquals still used with value types?
body: <p>There is a nice <a href="https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2013" rel="nofollow noreferrer">explanation</a> why <code>object.ReferenceEquals(this, obj)</code> must not be used for value types:</p>
  <blockquote>
  <p>When comparing values using ReferenceEquals, if objA and objB are
  value types, they are boxed before they are passed to the
  ReferenceEquals method. This means that even if both objA and objB
  represent the same instance of a value type, the ReferenceEquals
  method nevertheless returns false</p>
  </blockquote>
  <p>However, I found code similar to the following snippet:</p>
  <pre><code>internal readonly struct Foo
  {
      public override bool Equals(object obj)
      {
          if (object.ReferenceEquals(this, obj))
          {
              return true;
          }
  
          if (obj is Foo other)
          {
              return this.Equals(other);
          }
  
          return false;
      }
  
      public bool Equals(Foo other)
      {
          // ..
          return true;
      }
  }
  </code></pre>
  <p>Is this just wrong or is there an edge case in which <code>ReferenceEquals</code> could be useful (i.e., evaluate to true) for value types, especially structs?</p>