Details
-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Message:Use string, integral, index or range type here, or refactor this indexer into a method.
-
Highlighting:
-
Default Severity:Minor
-
Impact:Low
-
Likelihood:Low
-
Covered Languages:C#
-
Remediation Function:Constant/Issue
-
Constant Cost:20min
-
Analysis Scope:Main Sources, Test Sources
-
FxCop:UseIntegralOrStringArgumentForIndexers , CA1043
Description
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 }