S3876 — Strings or integral types should be used for indexers

Language
C#
Type
Code smell
Severity
Minor
Tags
design

Why is this an issue?

Strings and integral types are typically used as indexers. When some other type is required, it typically indicates design problems, and potentially a situation where a method should be used instead.

Noncompliant code example


public int this[MyCustomClass index]  // Noncompliant
{
    // get and set accessors
}

↑ Back to top