[Archive.is] Need to try this: … multiple default index properties having the same name …getters can be overloads … resolve …by type signature … – Thomas Mueller (dummzeuch) – Google+, thanks to marck for this brilliantly simple example:
private function GetColumnValue(const ColumnName: string): string; overload; function GetColumnValue(Index: Integer): string; overload; procedure SetColumnValue(Index: Integer; const Value: string); public property Values[const ColumnName: string]: string read GetColumnValue; default; property Values[ColumnIndex: Integer]: string read GetColumnValue write SetColumnValue; default; end;This means:
- you can have multiple default indexor properties
- the multiple indexor properties can have the same name e.g., Values
- the properties getters can be overloads (i.e. have the same name) e.g., GetColumnValue
- Delphi will resolve the overloads by type signature
–jeroen