Skip to content

Commit

Permalink
simplify read-only list conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
testfirstcoder authored and BEagle1984 committed Mar 16, 2024
1 parent 8fe7b84 commit 5c95b97
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,15 @@ public Task AbortAsync(SequenceAbortReason reason, Exception? exception = null)
/// <inheritdoc cref="ISequence.GetBrokerMessageIdentifiers" />
public IReadOnlyList<IBrokerMessageIdentifier> GetBrokerMessageIdentifiers()
{
IReadOnlyList<IBrokerMessageIdentifier> identifiers = _messageIdentifiers?.AsReadOnlyList() ??
Array.Empty<IBrokerMessageIdentifier>();
var identifiers = _messageIdentifiers ?? Enumerable.Empty<IBrokerMessageIdentifier>();

if (_sequences != null)
{
identifiers = identifiers
.Union(_sequences.SelectMany(sequence => sequence.GetBrokerMessageIdentifiers()))
.AsReadOnlyList();
.Union(_sequences.SelectMany(sequence => sequence.GetBrokerMessageIdentifiers()));
}

return identifiers;
return identifiers.AsReadOnlyList();
}

/// <inheritdoc cref="IDisposable.Dispose" />
Expand Down

0 comments on commit 5c95b97

Please sign in to comment.