Data Access, Properties, and Methods
- slide 16 : 29
Summary of indexers in C#
modifiers
return-type
this
[formal-parameter-list]
get
{
body-of-get
}
set
{
body-of-set
} }
Indexer characteristics
Provide for indexed read-only, write-only, or read-write access to data in objects
Indexers can only be instance members - not static
The indexing can be based on one, two or more formal parameters
Indexers can be overloaded
Indexers should be without unnecessary side-effects
Indexers should be fast