RCS9008: Call 'Last' instead of using []
Properties
Property | Value |
---|---|
Default Severity | Info |
Minimum language version | - |
Examples
Example #1
diagnostic.cs
syntaxList[syntaxList.Count - 1]
fix.cs
syntaxList.Last()
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