Property | indexers |
---|---|
allow methods to be called as if they were public data members. | Allows calling methods on an object as if the object were an array. |
Accessible by simple name. | Accessible via indexer. |
Can be a static member or an instance member. | Must be an instance member. |
The property's get accessor has no parameters. | The indexer's get accessor has the same formal parameter list as the indexer. |
The property's set accessor contains an implicit value parameter. | In addition to the value parameter, the indexer's set accessor has the same formal parameter list as the indexer. |
Let’s look at an example!
Next let’s look at an example of indexer overloading