我在读完这篇文章之后来到这里并且没有找到相关的答案 - 所以在你阅读整个问题之前,请不要将其标记为副本.
我一直在使用反射器并进行调查.Object.Equals我看到的是:
[__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
public virtual bool Equals(object obj)
{
return RuntimeHelpers.Equals(this, obj);
}
Run Code Online (Sandbox Code Playgroud)
而且RuntimeHelpers.Equals看起来是这样的:
// System.Runtime.CompilerServices.RuntimeHelpers
/// <summary>Determines whether the specified <see cref="T:System.Object" /> instances are considered equal.</summary>
/// <returns>true if the <paramref name="o1" /> parameter is the same instance as the <paramref name="o2" /> parameter, or if both are null, or if o1.Equals(o2) returns true; otherwise, false.</returns>
/// <param name="o1">The first object to …Run Code Online (Sandbox Code Playgroud)