Editorconfig Guide.e

Prefer index operator

EditorConfig key: csharp-style-prefer-index-operator

Prefer index operator

csharp-style-prefer-index-operator

This option controls whether the index-from-end operator should be preferred over calling ElementAt or indexing from the end manually.

Default value:

true

Possible values:

  • true
  • false

Examples

true
var x = list[0];
false
var x = list.ElementAt(0);