To have an indexer we use the following format:
class ClassName
{
DataType[] ArrayName = new DataType[Length];
public DataType this[int i]
{
get { return ArrayName[i]; }
}
}
For the sake of simplicity I used the format, even though we can go for a custom indexer also. According to my understanding, we are keeping a propery array that is indexed.
My question is :
- Is it a templated property?
- When and where could we achieve high degree code optimization using this indexer?