Avoid Count() when Any() could be used (CA1827)
This commit is contained in:
committed by
Pavel Penev
parent
7ba6a49378
commit
67aa0cdede
@@ -156,6 +156,9 @@ dotnet_diagnostic.CA1825.severity = warning
|
|||||||
# Do not use Enumerable methods on indexable collections. Instead use the collection directly.
|
# Do not use Enumerable methods on indexable collections. Instead use the collection directly.
|
||||||
dotnet_diagnostic.CA1826.severity = warning
|
dotnet_diagnostic.CA1826.severity = warning
|
||||||
|
|
||||||
|
# Count() is used where Any() could be used instead to improve performance.
|
||||||
|
dotnet_diagnostic.CA1827.severity = warning
|
||||||
|
|
||||||
# Use string.Contains(char) instead of string.Contains(string) with single characters.
|
# Use string.Contains(char) instead of string.Contains(string) with single characters.
|
||||||
dotnet_diagnostic.CA1847.severity = warning
|
dotnet_diagnostic.CA1847.severity = warning
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
foreach (var section in sections.OrderBy(s => s.Key))
|
foreach (var section in sections.OrderBy(s => s.Key))
|
||||||
{
|
{
|
||||||
var fields = section.Value.GetType().GetFields();
|
var fields = section.Value.GetType().GetFields();
|
||||||
if (fields.Length > 0 && fields.Where(field => field.GetCustomAttributes<DescAttribute>(false).Length > 0).Count() > 0)
|
if (fields.Any(field => field.GetCustomAttributes<DescAttribute>(false).Length > 0))
|
||||||
Console.WriteLine($"## {section.Key}");
|
Console.WriteLine($"## {section.Key}");
|
||||||
else
|
else
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
|||||||
Reference in New Issue
Block a user