From 5c95b97c9d972816b2abd2add8dab15cc7ed1e6a Mon Sep 17 00:00:00 2001 From: Andriy Tolstoy Date: Tue, 12 Mar 2024 11:06:25 +0100 Subject: [PATCH] simplify read-only list conversion --- .../Messaging/Sequences/SequenceBase`1.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Silverback.Integration/Messaging/Sequences/SequenceBase`1.cs b/src/Silverback.Integration/Messaging/Sequences/SequenceBase`1.cs index ff531d282..1483b93d4 100644 --- a/src/Silverback.Integration/Messaging/Sequences/SequenceBase`1.cs +++ b/src/Silverback.Integration/Messaging/Sequences/SequenceBase`1.cs @@ -230,17 +230,15 @@ public Task AbortAsync(SequenceAbortReason reason, Exception? exception = null) /// public IReadOnlyList GetBrokerMessageIdentifiers() { - IReadOnlyList identifiers = _messageIdentifiers?.AsReadOnlyList() ?? - Array.Empty(); + var identifiers = _messageIdentifiers ?? Enumerable.Empty(); if (_sequences != null) { identifiers = identifiers - .Union(_sequences.SelectMany(sequence => sequence.GetBrokerMessageIdentifiers())) - .AsReadOnlyList(); + .Union(_sequences.SelectMany(sequence => sequence.GetBrokerMessageIdentifiers())); } - return identifiers; + return identifiers.AsReadOnlyList(); } ///