C#


ROSLYN.DESIGN.CA1043 : Use Integral Or String Argument For Indexers (C#)

See Roslyn-Detected C# Warning Classes for more information.

Summary

Indexers, that is, indexed properties, should use integer or string types for the index. These types are typically used for indexing data structures and increase the usability of the library. Use of the Object type should be restricted to those cases where the specific integer or string type cannot be specified at design time. If the design requires other types for the index, reconsider whether the type represents a logical data store. If it does not represent a logical data store, use a method.

This check corresponds to Roslyn rule CA1043. For full rule details, see the Microsoft website: CA1043.

Properties

Class Name Use Integral Or String Argument For Indexers (C#)
Significance reliability
Mnemonic ROSLYN.DESIGN.CA1043
Categories None
Availability Available for C# only.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Use Integral Or String Argument For Indexers (C#)"

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.