Skip to content

Commit b05de2f

Browse files
committed
Resharper: Use collection expression
1 parent 206acbe commit b05de2f

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/JsonApiDotNetCore.OpenApi.Client/JsonApiClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ public bool IsAttributesObjectType(Type type)
124124
/// </summary>
125125
private sealed class DocumentJsonConverter : JsonConverter
126126
{
127-
private readonly Dictionary<object, AlwaysIncludedAttributes> _alwaysIncludedAttributesByDocument = new();
128-
private readonly Dictionary<Type, ISet<object>> _documentsByType = new();
127+
private readonly Dictionary<object, AlwaysIncludedAttributes> _alwaysIncludedAttributesByDocument = [];
128+
private readonly Dictionary<Type, ISet<object>> _documentsByType = [];
129129
private bool _isSerializing;
130130

131131
public override bool CanRead => false;

src/JsonApiDotNetCore.OpenApi/JsonApiActionDescriptorCollectionProvider.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ private ActionDescriptorCollection GetActionDescriptors()
4242
{
4343
JsonApiEndpointMetadataContainer endpointMetadataContainer = _jsonApiEndpointMetadataProvider.Get(endpoint.GetActionMethod());
4444

45-
List<ActionDescriptor> replacementDescriptorsForEndpoint = new();
46-
replacementDescriptorsForEndpoint.AddRange(AddJsonApiMetadataToAction(endpoint, endpointMetadataContainer.RequestMetadata));
47-
replacementDescriptorsForEndpoint.AddRange(AddJsonApiMetadataToAction(endpoint, endpointMetadataContainer.ResponseMetadata));
45+
List<ActionDescriptor> replacementDescriptorsForEndpoint =
46+
[
47+
.. AddJsonApiMetadataToAction(endpoint, endpointMetadataContainer.RequestMetadata),
48+
.. AddJsonApiMetadataToAction(endpoint, endpointMetadataContainer.ResponseMetadata)
49+
];
4850

4951
if (replacementDescriptorsForEndpoint.Any())
5052
{

src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceTypeSchemaGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal sealed class ResourceTypeSchemaGenerator
1212
private readonly ISchemaRepositoryAccessor _schemaRepositoryAccessor;
1313
private readonly IResourceGraph _resourceGraph;
1414
private readonly JsonNamingPolicy? _namingPolicy;
15-
private readonly Dictionary<Type, OpenApiSchema> _resourceClrTypeSchemaCache = new();
15+
private readonly Dictionary<Type, OpenApiSchema> _resourceClrTypeSchemaCache = [];
1616

1717
public ResourceTypeSchemaGenerator(ISchemaRepositoryAccessor schemaRepositoryAccessor, IResourceGraph resourceGraph, JsonNamingPolicy? namingPolicy)
1818
{

0 commit comments

Comments
 (0)