indexers_indexed_property
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| indexers_indexed_property [2018/09/09 04:51] – wolfgangriedmann | indexers_indexed_property [2018/09/11 08:37] (current) – wolfgangriedmann | ||
|---|---|---|---|
| Line 44: | Line 44: | ||
| return</ | return</ | ||
| + | |||
| + | Classes with indexed properties can also be used like classes with dynamic arrays. Please see this sample: | ||
| + | <code visualfoxpro> | ||
| + | protect _oValues as Dictionary< | ||
| + | |||
| + | constructor() | ||
| + | _oValues : | ||
| + | return | ||
| + | |||
| + | property self[cName as string] as string | ||
| + | get | ||
| + | local cValue as string | ||
| + | if _oValues: | ||
| + | cValue := "< not assigned >" | ||
| + | endif | ||
| + | return cValue | ||
| + | end get | ||
| + | set | ||
| + | if _oValues: | ||
| + | _oValues[cName] : | ||
| + | else | ||
| + | _oValues: | ||
| + | endif | ||
| + | end set | ||
| + | end property | ||
| + | |||
| + | end class</ | ||
| + | To be used like this: | ||
| + | <code visualfoxpro> | ||
| + | oObject[" | ||
| + | oObject[" | ||
| + | System.Console.WriteLine( " | ||
| + | System.Console.WriteLine( " | ||
| + | System.Console.WriteLine( " | ||
| + | |||
| Please see also this Microsoft article: [[https:// | Please see also this Microsoft article: [[https:// | ||
indexers_indexed_property.1536468688.txt.gz · Last modified: 2018/09/09 04:51 by wolfgangriedmann