diff --git a/Directory.Build.props b/Directory.Build.props
index d38c7488e8..260dfa0d63 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -104,7 +104,6 @@
[CA1845] Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring'
[CA1847] Use 'string.Contains(char)' instead of 'string.Contains(string)' - needs polyfill
[CA1854] Prefer a 'TryGetValue' call over a Dictionary indexer access
- [CA1860] Prefer comparing 'Count' to 0 rather than using 'Any()'
[CA1861] Prefer 'static readonly' fields over constant array arguments
[CA1862] Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison
[CA1865] Use 'string.StartsWith(char)' instead of 'string.StartsWith(string)' - needs polyfill
@@ -116,7 +115,7 @@
[SYSLIB0012] 'Assembly.CodeBase' is obsolete
-->
$(NoWarn);IDE0005;IDE0008;IDE0011;IDE0017;IDE0019;IDE0021;IDE0022;IDE0025;IDE0027;IDE0028;IDE0029;IDE0032;IDE0039;IDE0040;IDE0044;IDE0045;IDE0046;IDE0055;IDE0056;IDE0057;IDE0059;IDE0060;IDE0061;IDE0063;IDE0074;IDE0078;IDE0083;IDE0090;IDE0100;IDE0130;IDE0160;IDE0200;IDE0260;IDE0270;IDE0290;IDE0300;IDE0305;IDE0301;IDE0330;IDE1005
- $(NoWarn);CA1200;CA1304;CA1305;CA1310;CA1311;CA1507;CA1510;CA1514;CA1710;CA1716;CA1720;CA1725;CA1805;CA1827;CA1834;CA1845;CA1847;CA1854;CA1860;CA1861;CA1862;CA1865;CA1866;CA1870;CA2249;CA2263;SYSLIB0012
+ $(NoWarn);CA1200;CA1304;CA1305;CA1310;CA1311;CA1507;CA1510;CA1514;CA1710;CA1716;CA1720;CA1725;CA1805;CA1827;CA1834;CA1845;CA1847;CA1854;CA1861;CA1862;CA1865;CA1866;CA1870;CA2249;CA2263;SYSLIB0012
diff --git a/src/NSwag.AspNetCore/SwaggerUiSettings.cs b/src/NSwag.AspNetCore/SwaggerUiSettings.cs
index 7b6a2e7d1e..eed7d02176 100644
--- a/src/NSwag.AspNetCore/SwaggerUiSettings.cs
+++ b/src/NSwag.AspNetCore/SwaggerUiSettings.cs
@@ -134,7 +134,7 @@ public bool WithCredentials
public Func>> SwaggerRoutesFactory { get; set; }
#endif
- internal override string ActualSwaggerDocumentPath => SwaggerRoutes.Any() ? "" : base.ActualSwaggerDocumentPath;
+ internal override string ActualSwaggerDocumentPath => SwaggerRoutes.Count > 0 ? "" : base.ActualSwaggerDocumentPath;
#if AspNetOwin
internal override async Task TransformHtmlAsync(string html, IOwinRequest request, CancellationToken cancellationToken)
@@ -165,7 +165,7 @@ internal override async Task TransformHtmlAsync(string html, HttpRequest
(await SwaggerRoutesFactory(request, cancellationToken)).ToList() :
SwaggerRoutes;
- htmlBuilder.Replace("{Urls}", !swaggerRoutes.Any()
+ htmlBuilder.Replace("{Urls}", swaggerRoutes.Count == 0
? "undefined"
: JsonConvert.SerializeObject(
#pragma warning disable 618
diff --git a/src/NSwag.CodeGeneration.CSharp/Models/CSharpOperationModel.cs b/src/NSwag.CodeGeneration.CSharp/Models/CSharpOperationModel.cs
index 1de28ebd91..2ab1bd37d9 100644
--- a/src/NSwag.CodeGeneration.CSharp/Models/CSharpOperationModel.cs
+++ b/src/NSwag.CodeGeneration.CSharp/Models/CSharpOperationModel.cs
@@ -169,7 +169,7 @@ public IEnumerable ExceptionDescriptions
.Where(r => r.ThrowsException)
.SelectMany(r =>
{
- if (r.ExpectedSchemas?.Any() == true)
+ if (r.ExpectedSchemas?.Count > 0)
{
return r.ExpectedSchemas
.Where(s => s.Schema.ActualSchema?.InheritsSchema(_resolver.ExceptionSchema) == true)
diff --git a/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs b/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs
index 6c6538ba4f..2bfcd45aae 100644
--- a/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs
+++ b/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs
@@ -42,7 +42,7 @@ public async Task