Which keyword is used to declare an indexer in a C# class?
Correct answer A. this
Explanation
An indexer is declared like a property whose name is this followed by parameters in square brackets: public int this[int i] { get => data[i]; set => data[i] = value; }. Objects can then be accessed with array syntax such as obj[2]. Indexers can be overloaded with different parameter types, for example a string key. Item is the name the compiler emits internally.
Answer checked How we write and check questions
Discussion