Skip to main content

RCS9006: Use element access

Properties

PropertyValue
Default SeverityInfo
Minimum language version-

Examples

Example #1

diagnostic.cs
syntaxList.First()
fix.cs
syntaxList[0]

Example #2

diagnostic.cs
triviaList.ElementAt(1)
fix.cs
triviaList[1]

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

Applies to