Skip to content

Commit 6e32ad5

Browse files
committed
Fix CA1860: Avoid using 'Enumerable.Any()' extension method
1 parent ef56e34 commit 6e32ad5

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void UnRegisterDocument(object document)
153153
Type documentType = document.GetType();
154154
_documentsByType[documentType].Remove(document);
155155

156-
if (!_documentsByType[documentType].Any())
156+
if (_documentsByType[documentType].Count == 0)
157157
{
158158
_documentsByType.Remove(documentType);
159159
}

src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiActionDescriptorCollectionProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ .. AddJsonApiMetadataToAction(endpoint, endpointMetadataContainer.RequestMetadat
5252
.. AddJsonApiMetadataToAction(endpoint, endpointMetadataContainer.ResponseMetadata)
5353
];
5454

55-
if (replacementDescriptorsForEndpoint.Any())
55+
if (replacementDescriptorsForEndpoint.Count > 0)
5656
{
5757
newDescriptors.InsertRange(newDescriptors.IndexOf(endpoint) - 1, replacementDescriptorsForEndpoint);
5858
newDescriptors.Remove(endpoint);

src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiEndpointConvention.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private bool ShouldSuppressEndpoint(JsonApiEndpoint endpoint, ResourceType? reso
7171

7272
if (IsSecondaryOrRelationshipEndpoint(endpoint))
7373
{
74-
if (!resourceType.Relationships.Any())
74+
if (resourceType.Relationships.Count == 0)
7575
{
7676
return true;
7777
}

src/JsonApiDotNetCore.OpenApi.Swashbuckle/SchemaGenerators/Components/DataSchemaGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private void SetResourceAttributes(OpenApiSchema fullSchemaForResourceData, bool
184184

185185
builder.SetMembersOfAttributes(fullSchemaForAttributes, forRequestSchema, schemaRepository);
186186

187-
if (!fullSchemaForAttributes.Properties.Any())
187+
if (fullSchemaForAttributes.Properties.Count == 0)
188188
{
189189
fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Attributes);
190190
}
@@ -202,7 +202,7 @@ private void SetResourceRelationships(OpenApiSchema fullSchemaForResourceData, b
202202

203203
builder.SetMembersOfRelationships(fullSchemaForRelationships, forRequestSchema, schemaRepository);
204204

205-
if (!fullSchemaForRelationships.Properties.Any())
205+
if (fullSchemaForRelationships.Properties.Count == 0)
206206
{
207207
fullSchemaForResourceData.Properties.Remove(JsonApiPropertyName.Relationships);
208208
}

0 commit comments

Comments
 (0)