Find the indexer in the class.
C # allows you to define indexers to allow this kind of access.
Here is an example from the official guide for "SampleCollection".
public T this[int i] { get {
Here is the definition from the official language specification :
Index is a member that allows objects to be indexed just like an array. An indexer is declared as a property, except that it is the name of the element, followed by a list of parameters written between the delimiters [and]. Parameters are available in the indexer accessories (s). Like properties, indexers can be read and written, read-only and write-only, and indexer accessors (and) can be virtual.
A complete and complete definition can be found in section 10.9 of the Indexers specification.
Benjamin Gruenbaum May 20 '13 at 1:07 pm 2013-05-20 13:07
source share