This project has moved and is read-only. For the latest updates, please go here.

Custom type property binding

Feb 15, 2012 at 3:15 PM

Hi Roman,

I would like to bind a custom type property (or field), exposed on an instanciated type injected in the LanguageRuntime at construction time, and being able to index access it directly in the expression script.

For example :

MyCollection[1].TotalAmount >= 1200

Where MyCollection is a List<T> property of my custom type.

I found the method binding pattern (BuiltIns.AddMethod). However, if i use this approach, i would have to use a method call syntax in the script (with parenthesis). 

MyCollection(1).TotalAmount >= 1200


x = MyCollection()
x[1].TotalAmount >= 1200

Both previous syntax are a bit overwhelming. Direct access to the collection type in the script would be super cool.

Do you have any suggestion ?


Feb 15, 2012 at 3:59 PM

there's Globals collection for all global variables - add the object there

Feb 15, 2012 at 4:17 PM

Awesome, works like a charm.

Thanks for your quick answer!