简体   繁体   中英

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 that 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, eg (myobject as duck).Percent . See http://boo.codehaus.org/Duck+Typing for reference.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM