Why an indexer can be declared only by using 'this' keyword.....? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why an indexer can be declared only by using 'this' keyword.....?

Without using 'this' keyword, can't we declare an indexer.....?

4th Oct 2016, 1:43 PM
Praneeth Valeti
Praneeth Valeti - avatar
2 Answers
+ 1
That is the syntax in C#. As Oussama points out, the 'this' keyword refers to the object itself, the brackets denote the indexer. In other languages this works a bit different.
2nd Nov 2016, 4:12 PM
Bart Genuit
Bart Genuit - avatar
0
because it is related to the current instance
15th Oct 2016, 9:19 AM
Oussama Abbas
Oussama Abbas - avatar