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. This usually depends on whether the object is a container for some other object. If the indexer only has a getter, consider replacing it with a method. Get the code for this issue here .