Indexers are a little confusing. I'm not sure I know what their uses are? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Indexers are a little confusing. I'm not sure I know what their uses are?

20th Apr 2016, 8:49 AM
Greg Mavhunga
Greg Mavhunga - avatar
2 Answers
+ 3
indexers allows instance of a class to be indexed like an array in the example they have declared names[] private(encapsulation principle)of ten elements, since we need to access to each element to modify it (set or get) you need to define an indexer [email protected]
17th Jun 2016, 6:58 PM
Mohamed Saged Hussen Mohamed
Mohamed Saged Hussen Mohamed - avatar
+ 1
indexers are useful mostly in collection classes
27th Apr 2016, 10:43 PM
Anusuya Rangasamy