Question on string indexers

On page 300, in the sample program, the "get" accessor for the integer indexer is written as "return strings[index];", which works. However, further down that page, the "get" accessor for the string indexer is written as "return this[FindString(index)];" which likewise works, although I don't understand why. It would come natural to me to write this as "return strings[FindString(index)]", which also works and which is consistent with the format used by the integer "get" indexer. The book does not discuss why "this" was used in place of "strings", and I confess I do not understand the subtlety here. Can you explain?
1 person has
this question
+1
Reply