How can i use c# dynamic object in boo (Rhino DSL)?
I am using Rhino DSL and when I want to pass a dynamic object into script, boo compiler throws the Exception below: BCE0019: Boo.Lang.Compiler.CompilerError: 'Percent' is not a member of 'object'.
my boo code:
Result = Run().Percent
C# Dsl Base code for Run method:
dynamic myDynamicObject;
public dynamic Run()
{
//do somthing
return myDynamicObject;
}
- in Run method I set myDynamicObject to a class t开发者_如何学JAVAhat inherits from DynamicObject and override TrySetValue & TryGetValue method
Not sure how exactly 'Percent' is being called, or if Rhino.DSL is configured with ducky Boo as default, but you can try 'casting' as duck, e.g. (myobject as duck).Percent
. See http://boo.codehaus.org/Duck+Typing for reference.
精彩评论