Closed cesaryuan closed 3 years ago
Hello @cesaryuan ,
Thank you for reporting, we will look at this to see if that's something we could support or not.
Best Regards,
Jon
Hello @se ,
The v4.0.29 has been released.
Could you try it and let us know if we successfully added the code to handle delegate correctly?
Best Regards,
Jon
Works for me! But it seems that still not support using delegate keyword to initialize an delegate (you said in the readme that you support all keyword). Anyway, lambda expression is enough. Thank you! @JonathanMagnan
Thank,
We will look at it if we can do it.
Hello @cesaryuan ,
It took us a while but the v4.0.30 has been finally released.
We now support several case with delegate such as:
var delegateAction = Eval.Execute<Action>(@"Action greet = delegate { Console.WriteLine(""Hello!""); };");
delegateAction();
var delegateFunc = Eval.Execute<Func<int, int, int>>(@"Func<int, int, int> sum = delegate (int a, int b) { return a + b; }; return sum;");
var x1 = delegateFunc(1, 2);
If you still have some issue with your delegate, please provide us a full example about what you will want to do and we will look at it.
Best Regards,
Jon
@JonathanMagnan Thanks for your effort! This is genuinely nice, and there is no issue for me.
Is it possible to support using an anonymous method or a lambda expression to declare and initialize a delegate? I test the follow example, but it throw error.
The detail errors like this,