As a property looks like a field but has accessors to perform get and set operations, an indexer looks like an array, but has accessors to perform array indexing operations. Reprinted with permission. The DataRow class has functions to load in a row of data, functions to save the data, and an indexer function to provide access to the data. The indexer function is written the same way that a property is written, except that it takes an indexing parameter. A class can have more than one indexer.
Indexers can have more than one parameter, to simulate a multidimensional virtual array.
If an object can be treated as an array, it is often convenient to iterate through it using the foreach statement. To enable the use of foreach, and similar constructs in other .NET languages, the IEnumerable interface must be implemented by the object. The IEnumerator interface can be implemented directly by the container class, or it can be implemented by a private class. Private implementation is preferable since it simplifies the collection class. Design Guidelines Indexers should be used only in situations where the abstraction makes sense.