title: C# Type Comparison: Type.Equals vs operator ==
body: <p>ReSharper suggests that the following be changed from:</p>
  <pre><code>Type foo = typeof( Foo );
  Type bar = typeof( Bar );
  
  if( foo.Equals( bar ) ) { ... }
  </code></pre>
  <p>To:</p>
  <pre><code>if( foo == bar ) { ... }
  </code></pre>
  <p><strong>operator ==</strong></p>
  <pre><code>// Summary:
  //     Indicates whether two System.Type objects are equal.
  //
  // Parameters:
  //   left:
  //     The first object to compare.
  //
  //   right:
  //     The second object to compare.
  //
  // Returns:
  //     true if left is equal to right; otherwise, false.
  public static bool operator ==( Type left, Type right );
  </code></pre>
  <p><strong>Equals( Type o )</strong></p>
  <pre><code>// Summary:
  //     Determines if the underlying system type of the current System.Type is the
  //     same as the underlying system type of the specified System.Type.
  //
  // Parameters:
  //   o:
  //     The System.Type whose underlying system type is to be compared with the underlying
  //     system type of the current System.Type.
  //
  // Returns:
  //     true if the underlying system type of o is the same as the underlying system
  //     type of the current System.Type; otherwise, false.
  public virtual bool Equals( Type o );
  </code></pre>
  <p><strong>Question</strong><br />
  Why would <code>operator ==</code> be recommended over <code>Equals( Type o )</code> when comparing Types?</p>