Closed JangoBoogaloo closed 1 year ago
Hi @JangoBoogaloo,
Instead of using Func
, you can define a delegate type that captures Path.Combine
's support for parameter arrays:
private delegate string PathCombine(params string[] args);
Now you can achieve the desired result via JavaScript's spread syntax:
engine.AddHostObject("__path__combine", new PathCombine(Path.Combine));
engine.Execute("var x = ['a', 'b', 'c']; __path__combine(...x)");
Good luck!
It works as expected. Thanks!
I am trying to delegate Path.Combine method into javascript and I am not able to call the method with
apply
. Can I get some hint for how to delegate array parameter method?