Skip to content

Commit

Permalink
Merge pull request #1577 from rabbitmq/lukebakken/review-allocations
Browse files Browse the repository at this point in the history
Remove two unnecessary `.Cast<>()` usages
  • Loading branch information
lukebakken authored May 24, 2024
2 parents 41accbd + 393032b commit bf89475
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions projects/RabbitMQ.Client/client/impl/AsyncEventingWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using RabbitMQ.Client.Events;

Expand Down Expand Up @@ -55,7 +54,7 @@ public Task InvokeAsync(object sender, T parameter)

private readonly async Task InternalInvoke(Delegate[] handlers, object sender, T parameter)
{
foreach (AsyncEventHandler<T> action in handlers.Cast<AsyncEventHandler<T>>())
foreach (AsyncEventHandler<T> action in handlers)
{
try
{
Expand Down
3 changes: 1 addition & 2 deletions projects/RabbitMQ.Client/client/impl/EventingWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Linq;

namespace RabbitMQ.Client.Impl
{
Expand Down Expand Up @@ -53,7 +52,7 @@ public void Invoke(object sender, T parameter)
_handlers = handlers;
}

foreach (EventHandler<T> action in handlers.Cast<EventHandler<T>>())
foreach (EventHandler<T> action in handlers)
{
try
{
Expand Down

0 comments on commit bf89475

Please sign in to comment.