diff --git a/.editorconfig b/.editorconfig
index 84059808..840e3c38 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -17,7 +17,9 @@ dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
-csharp_style_namespace_declarations=file_scoped:warning
+csharp_style_namespace_declarations = file_scoped:warning
+dotnet_style_prefer_collection_expression = true:warning
+dotnet_style_collection_initializer = true:warning
# ReSharper properties
resharper_int_align_switch_expressions = true
diff --git a/src/NSubstitute/Compatibility/DiagnosticsNullabilityAttributes.cs b/src/NSubstitute/Compatibility/DiagnosticsNullabilityAttributes.cs
index a016b1f3..e3cdd540 100644
--- a/src/NSubstitute/Compatibility/DiagnosticsNullabilityAttributes.cs
+++ b/src/NSubstitute/Compatibility/DiagnosticsNullabilityAttributes.cs
@@ -90,7 +90,7 @@ internal sealed class MemberNotNullAttribute : Attribute
///
/// The field or property member that is promised to be not-null.
///
- public MemberNotNullAttribute(string member) => Members = new[] { member };
+ public MemberNotNullAttribute(string member) => Members = [member];
/// Initializes the attribute with the list of field and property members.
///
@@ -116,7 +116,7 @@ internal sealed class MemberNotNullWhenAttribute : Attribute
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
- Members = new[] { member };
+ Members = [member];
}
/// Initializes the attribute with the specified return value condition and list of field and property members.
diff --git a/src/NSubstitute/Core/ArgumentSpecificationDequeue.cs b/src/NSubstitute/Core/ArgumentSpecificationDequeue.cs
index 0c251d6d..7dfd76d8 100644
--- a/src/NSubstitute/Core/ArgumentSpecificationDequeue.cs
+++ b/src/NSubstitute/Core/ArgumentSpecificationDequeue.cs
@@ -5,7 +5,7 @@ namespace NSubstitute.Core;
public class ArgumentSpecificationDequeue : IArgumentSpecificationDequeue
{
- private static readonly IArgumentSpecification[] EmptySpecifications = new IArgumentSpecification[0];
+ private static readonly IArgumentSpecification[] EmptySpecifications = [];
private readonly Func> _dequeueAllQueuedArgSpecs;
diff --git a/src/NSubstitute/Core/Arguments/ArrayContentsArgumentMatcher.cs b/src/NSubstitute/Core/Arguments/ArrayContentsArgumentMatcher.cs
index cfeb2555..ca7c66ac 100644
--- a/src/NSubstitute/Core/Arguments/ArrayContentsArgumentMatcher.cs
+++ b/src/NSubstitute/Core/Arguments/ArrayContentsArgumentMatcher.cs
@@ -31,7 +31,7 @@ public bool IsSatisfiedBy(object? argument)
public string Format(object? argument, bool highlight)
{
- var argArray = argument is IEnumerable enumerableArgs ? enumerableArgs.Cast