diff --git a/src/Tingle.EventBus.Transports.Amazon.Sqs/AmazonSqsTransport.cs b/src/Tingle.EventBus.Transports.Amazon.Sqs/AmazonSqsTransport.cs index ee80072c..8bd4f736 100644 --- a/src/Tingle.EventBus.Transports.Amazon.Sqs/AmazonSqsTransport.cs +++ b/src/Tingle.EventBus.Transports.Amazon.Sqs/AmazonSqsTransport.cs @@ -375,7 +375,7 @@ private async Task ReceiveAsync(EventRegistration reg, EventConsumerRegistration using var scope = CreateScope(); // shared foreach (var message in messages) { - await ((Task)method.Invoke(this, new object[] { reg, ecr, queueUrl, message, cancellationToken, })!).ConfigureAwait(false); + await ((Task)method.Invoke(this, [reg, ecr, queueUrl, message, cancellationToken])!).ConfigureAwait(false); } } } diff --git a/src/Tingle.EventBus.Transports.Azure.EventHubs/AzureEventHubsTransport.cs b/src/Tingle.EventBus.Transports.Azure.EventHubs/AzureEventHubsTransport.cs index feda0b29..842787b5 100644 --- a/src/Tingle.EventBus.Transports.Azure.EventHubs/AzureEventHubsTransport.cs +++ b/src/Tingle.EventBus.Transports.Azure.EventHubs/AzureEventHubsTransport.cs @@ -63,7 +63,7 @@ protected override async Task StartCoreAsync(CancellationToken cancellationToken var flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic; var mt = GetType().GetMethod(nameof(OnEventReceivedAsync), flags) ?? throw new InvalidOperationException("Methods should be null"); var method = mt.MakeGenericMethod(reg.EventType, ecr.ConsumerType); - return (Task)method.Invoke(this, new object[] { reg, ecr, processor, args, })!; + return (Task)method.Invoke(this, [reg, ecr, processor, args])!; }; // start processing diff --git a/src/Tingle.EventBus.Transports.Azure.QueueStorage/AzureQueueStorageTransport.cs b/src/Tingle.EventBus.Transports.Azure.QueueStorage/AzureQueueStorageTransport.cs index f7240ed4..5fc00d5d 100644 --- a/src/Tingle.EventBus.Transports.Azure.QueueStorage/AzureQueueStorageTransport.cs +++ b/src/Tingle.EventBus.Transports.Azure.QueueStorage/AzureQueueStorageTransport.cs @@ -276,7 +276,7 @@ private async Task ReceiveAsync(EventRegistration reg, EventConsumerRegistration using var scope = CreateScope(); // shared foreach (var message in messages) { - await ((Task)method.Invoke(this, new object[] { reg, ecr, queueClient, message, scope, cancellationToken, })!).ConfigureAwait(false); + await ((Task)method.Invoke(this, [reg, ecr, queueClient, message, scope, cancellationToken])!).ConfigureAwait(false); } } } diff --git a/src/Tingle.EventBus.Transports.Azure.ServiceBus/AzureServiceBusTransport.cs b/src/Tingle.EventBus.Transports.Azure.ServiceBus/AzureServiceBusTransport.cs index 3ab59b7c..0fdb6093 100644 --- a/src/Tingle.EventBus.Transports.Azure.ServiceBus/AzureServiceBusTransport.cs +++ b/src/Tingle.EventBus.Transports.Azure.ServiceBus/AzureServiceBusTransport.cs @@ -88,7 +88,7 @@ protected override async Task StartCoreAsync(CancellationToken cancellationToken var flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic; var mt = GetType().GetMethod(nameof(OnMessageReceivedAsync), flags) ?? throw new InvalidOperationException("Methods should be null"); var method = mt.MakeGenericMethod(reg.EventType, ecr.ConsumerType); - return (Task)method.Invoke(this, new object[] { reg, ecr, processor, args, })!; + return (Task)method.Invoke(this, [reg, ecr, processor, args])!; }; // start processing diff --git a/src/Tingle.EventBus.Transports.InMemory/Client/InMemorySender.cs b/src/Tingle.EventBus.Transports.InMemory/Client/InMemorySender.cs index ea04a856..76f070db 100644 --- a/src/Tingle.EventBus.Transports.InMemory/Client/InMemorySender.cs +++ b/src/Tingle.EventBus.Transports.InMemory/Client/InMemorySender.cs @@ -157,7 +157,7 @@ public async Task CancelScheduledMessageAsync(long sequenceNumber, CancellationT ?? throw new ArgumentException($"An item with the sequence number {sequenceNumber} does not exist.", nameof(sequenceNumber)); // make new items and replace - items = items.AsEnumerable().Except(new[] { matching }).ToList(); + items = items.AsEnumerable().Except([matching]).ToList(); } finally { diff --git a/src/Tingle.EventBus.Transports.InMemory/InMemoryTransport.cs b/src/Tingle.EventBus.Transports.InMemory/InMemoryTransport.cs index 45ae70d4..1c4defb8 100644 --- a/src/Tingle.EventBus.Transports.InMemory/InMemoryTransport.cs +++ b/src/Tingle.EventBus.Transports.InMemory/InMemoryTransport.cs @@ -74,7 +74,7 @@ protected override async Task StartCoreAsync(CancellationToken cancellationToken var flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic; var mt = GetType().GetMethod(nameof(OnMessageReceivedAsync), flags) ?? throw new InvalidOperationException("Methods should be null"); var method = mt.MakeGenericMethod(reg.EventType, ecr.ConsumerType); - return (Task)method.Invoke(this, new object[] { reg, ecr, processor, args, })!; + return (Task)method.Invoke(this, [reg, ecr, processor, args])!; }; // start processing diff --git a/src/Tingle.EventBus.Transports.Kafka/KafkaTransport.cs b/src/Tingle.EventBus.Transports.Kafka/KafkaTransport.cs index 54d3d239..cbc0e3f0 100644 --- a/src/Tingle.EventBus.Transports.Kafka/KafkaTransport.cs +++ b/src/Tingle.EventBus.Transports.Kafka/KafkaTransport.cs @@ -255,7 +255,7 @@ private async Task ProcessAsync(CancellationToken cancellationToken) // form the generic method var ecr = reg.Consumers.Single(); // only one consumer per event var method = mt.MakeGenericMethod(reg.EventType, ecr.ConsumerType); - await ((Task)method.Invoke(this, new object[] { reg, ecr, result, cancellationToken, })!).ConfigureAwait(false); + await ((Task)method.Invoke(this, [reg, ecr, result, cancellationToken])!).ConfigureAwait(false); } catch (TaskCanceledException) { diff --git a/src/Tingle.EventBus.Transports.RabbitMQ/RabbitMqTransport.cs b/src/Tingle.EventBus.Transports.RabbitMQ/RabbitMqTransport.cs index 092ddb79..4d37283b 100644 --- a/src/Tingle.EventBus.Transports.RabbitMQ/RabbitMqTransport.cs +++ b/src/Tingle.EventBus.Transports.RabbitMQ/RabbitMqTransport.cs @@ -277,7 +277,7 @@ private async Task ConnectConsumersAsync(CancellationToken cancellationToken) var flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic; var mt = GetType().GetMethod(nameof(OnMessageReceivedAsync), flags) ?? throw new InvalidOperationException("Methods should be null"); var method = mt.MakeGenericMethod(reg.EventType, ecr.ConsumerType); - return (Task)method.Invoke(this, new object[] { reg, ecr, channel, @event, CancellationToken.None, })!; // do not chain CancellationToken + return (Task)method.Invoke(this, [reg, ecr, channel, @event, CancellationToken.None])!; // do not chain CancellationToken }; channel.BasicConsume(queue: queueName, autoAck: false, consumer); }