开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜