Skip to content

Commit

Permalink
remove unecessary ToArray alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored and oskardudycz committed May 23, 2024
1 parent 7c69d99 commit 227b204
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Core/Aggregates/Aggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public abstract class Aggregate<TEvent, TId>: IAggregate<TEvent>

public object[] DequeueUncommittedEvents()
{
var dequeuedEvents = uncommittedEvents.ToArray();
var dequeuedEvents = uncommittedEvents.Cast<object>().ToArray();;

uncommittedEvents.Clear();

return dequeuedEvents.Cast<object>().ToArray();
return dequeuedEvents;
}

protected void Enqueue(TEvent @event)
Expand Down

0 comments on commit 227b204

Please sign in to comment.