diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc.ApiExplorer/GroupedApiVersionDescriptionProvider.cs b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc.ApiExplorer/GroupedApiVersionDescriptionProvider.cs
index c8b53796..d15d45fb 100644
--- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc.ApiExplorer/GroupedApiVersionDescriptionProvider.cs
+++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc.ApiExplorer/GroupedApiVersionDescriptionProvider.cs
@@ -441,10 +441,14 @@ public GroupedApiVersionMetadata( string? groupName, ApiVersionMetadata metadata
public string? GroupName { get; }
///
- public bool Equals( GroupedApiVersionMetadata? other ) => other is not null && other.GetHashCode() == GetHashCode();
+ public bool Equals( GroupedApiVersionMetadata? other ) =>
+ other is not null && other.GetHashCode() == GetHashCode();
///
- public override bool Equals( object? obj ) => Equals( obj as GroupedApiVersionMetadata );
+ public override bool Equals( object? obj ) =>
+ obj is not null &&
+ GetType().Equals( obj.GetType() ) &&
+ GetHashCode() == obj.GetHashCode();
///
public override int GetHashCode()