From 06681a8ee83327c60e0b9d283514d5195938f875 Mon Sep 17 00:00:00 2001 From: Buyaa Namnan Date: Thu, 4 Aug 2022 14:38:16 -0700 Subject: [PATCH] Update RuntimeConstructorInfo Equals, HashCode similarly --- .../src/System/Reflection/RuntimeConstructorInfo.CoreCLR.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.CoreCLR.cs index b9145526273a2..4981fbae094b5 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.CoreCLR.cs @@ -121,9 +121,9 @@ public override string ToString() } public override bool Equals(object? obj) => - obj is RuntimeConstructorInfo ci && m_handle == ci.m_handle; + obj is RuntimeConstructorInfo ci && m_handle == ci.m_handle && ReferenceEquals(m_declaringType, ci.m_declaringType); - public override int GetHashCode() => RuntimeHelpers.GetHashCodeOfPtr(m_handle); + public override int GetHashCode() => HashCode.Combine(RuntimeHelpers.GetHashCodeOfPtr(m_handle), m_declaringType.GetHashCode()); #endregion #region ICustomAttributeProvider