C# - Indexer at its meaningful application
c#, language-features
Solution
Look to almost any of the collection classes in the framework for an example. If I were to retrieve an item from a hashtable in a language without an indexer, I would use syntax like:
object o = table.getvalue(key);
where an indexer allows somewhat simpler syntax:
object o = table[key];
(purposely ignoring typing/generics issues in the samples above)
Problem
I understand indexer enable us to access a collection within a class as though the class itself were an array. Suppose we are developing a project ,where do we fit the real pratical usage (example may help) of such indexers ?