Skip to content

Commit a5a8db4

Browse files
authored
Avoid boxing in IEndpointResolverExtensions.cs
Technically T can be a value type. `Object.Equals` has an overload that takes `object` therefore any struct would be boxed. To avoid it, `EqualityComparer<T>.Default.Equals` should be used.
1 parent 89d472d commit a5a8db4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

projects/RabbitMQ.Client/client/api/IEndpointResolverExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static async Task<T> SelectOneAsync<T>(this IEndpointResolver resolver,
7171
}
7272
}
7373

74-
if (Object.Equals(t, default(T)) && exceptions.Count > 0)
74+
if (EqualityComparer<T>.Default.Equals(t, default(T)) && exceptions.Count > 0)
7575
{
7676
throw new AggregateException(exceptions);
7777
}

0 commit comments

Comments
 (0)