The following code compiles fine. However if you replace the type in the declaration of Foo with USUAL then the code fails at runtime.
using System.Collections.Generic
FUNCTION Start() AS VOID
local oFoo as Foo
oFoo := Foo{}
oFoo:Bar["abc"] := "def"
? oFoo:Bar["abc"]
? oFoo:_Bar["abc"]
CLASS Foo
public _bar as Dictionary<usual, usual>
constructor
_bar := Dictionary<usual, usual>{}
PROPERTY Bar[index as usual] as usual
get
return _bar[index]
end get
set
_bar[index] := value
end set
end property
end class
Both functions should accept an array of indices
Inside IVarGetCollection and IVarPutCollection the runtime should check to see if Bar is a normal IVar that returns an Array or if it is an indexed property. And of course, Bar could also be a field that has an indexer (like the public _bar in the example).
The following code compiles fine. However if you replace the type in the declaration of Foo with
USUAL
then the code fails at runtime.The compiler should translate to something like
Both functions should accept an array of indices Inside IVarGetCollection and IVarPutCollection the runtime should check to see if Bar is a normal IVar that returns an Array or if it is an indexed property. And of course, Bar could also be a field that has an indexer (like the public _bar in the example).