codesamples:indexed_property
Indexed Property
using System.Collections.Generic
function Start() as void
local oObject as IndexedProperty
oObject := IndexedProperty{}
oObject["MyProp"] := "Hello X#"
oObject["Prop2"] := "Hello again"
System.Console.WriteLine( "MyProp:" + oObject["MyProp"] )
System.Console.WriteLine( "Prop2:" + oObject["Prop2"] )
System.Console.WriteLine( "Prop3:" + oObject["Prop3"] )
return
class IndexedProperty
protect _oValues as Dictionary<string,string>
constructor()
_oValues := Dictionary<string,string>{}
return
property self[cName as string] as string
get
if _oValues:ContainsKey( cName )
return _oValues[cName]
else
return "< not assigned >"
endif
end get
set
if _oValues:ContainsKey( cName )
_oValues[cName] := value
else
_oValues:Add( cName, value )
endif
end set
end property
end class
codesamples/indexed_property.txt · Last modified: 2018/05/30 14:58 by wolfgangriedmann