diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceIdentifier.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceIdentifier.cs index 8b526532534952..d7f829be54011a 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceIdentifier.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceIdentifier.cs @@ -32,11 +32,11 @@ public bool Equals(ServiceIdentifier other) { if (ServiceKey == null && other.ServiceKey == null) { - return ServiceType.Equals(other.ServiceType); + return ServiceType == other.ServiceType; } else if (ServiceKey != null && other.ServiceKey != null) { - return ServiceType.Equals(other.ServiceType) && ServiceKey.Equals(other.ServiceKey); + return ServiceType == other.ServiceType && ServiceKey.Equals(other.ServiceKey); } return false; }