Stats

122 Contributors: 3 Sunday, August 7, 2016
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Indexer

Syntax

  • public ReturnType this[IndexType index] { get { ... } set { ... }}

Remarks

Indexer allows array-like syntax to access a property of an object with an index.

  • Can be used on a class, struct or interface.
  • Can be overloaded.
  • Can use multiple parameters.
  • Can be used to access and set values.
  • Can use any type for it's index.

Related Examples