O'Reilly logo

Special Edition Using C# by NIIT

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Indexers

In indexers, accessors are used for indexing arrays. An indexer is an element that enables instances of classes, structs, and other objects to be indexed or categorized in the same way as in arrays. An indexer can be written for an object that can be linked to an array. In properties, accessors are used for the get and set actions. An indexer enables programmers to use the syntax of an array to access the class that encapsulates the array. You also can use an indexer to access classes that encapsulate collection-like functionality. Declaring an indexer enables you to create classes that are like virtual arrays.

Note

Declaring an indexer in C# is comparable with declaring a [] operator in C++. Indexers, however, are more flexible. You ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required