The indexer does not need to be declared, and can be used directly on the class that declares the indexer.
The main difference between indexers and arrays is that
The type of index value of indexer is not necessarily an integer.
The index value used to access the array must be an integer, but the indexer can define other types of index values.
Indexers allow overloading.
A class is not limited to defining only one indexer. As long as the function signatures of indexers are different, a class can have many indexers, and you can overload its functions.
Indexer is not a variable.
The difference between an index and an array is that an indexer does not directly correspond to a reference data store, while an array directly corresponds to a reference data store. Indexers have get accessors and set accessors, which are used to indicate the code to be executed when reading or writing indexer elements.
In your example, there is an int array or collection inside MyClass, and the index you use actually refers to the internal collection class.