RCS9004: Call 'Any' instead of accessing 'Count'
Properties
Property | Value |
---|---|
Default Severity | Info |
Minimum language version | - |
Examples
Example #1
diagnostic.cs
syntaxList.Count > 0
fix.cs
syntaxList.Any()
Example #2
diagnostic.cs
syntaxList.Count == 0
fix.cs
!syntaxList.Any()
Remarks
This analyzer is applicable for following types:
Microsoft.CodeAnalysis.ChildSyntaxList
Microsoft.CodeAnalysis.SeparatedSyntaxList<TNode>
Microsoft.CodeAnalysis.SyntaxList<TNode>
Microsoft.CodeAnalysis.SyntaxNodeOrTokenList
Microsoft.CodeAnalysis.SyntaxTokenList
Microsoft.CodeAnalysis.SyntaxTriviaList