Ironjs:将对象返回给 JS

发布于 2024-12-02 22:08:09 字数 265 浏览 3 评论 0原文

使用 Ironjs。我将 ac# 函数注册为 JS 函数(通过 SetGlobal)

它被调用,但我想从该函数返回一个值。该值是 CLR 对象的 IEnumerable。使用 Jint 就可以了:我返回对象并可以 foreach 它等,我如何在 IronJS 中做同样的事情(为什么不使用 Jint,它有错误,例如它不会编译 underscore.js)

编辑:因为我是我不是一个流利的 F# 人,我无法通过阅读代码来回答这个问题。所以我修复了 Jint。不过如果能知道答案还是很高兴

Using Ironjs. I have a c# function registered as a JS function (via SetGlobal)

It gets called , but I want to return a value to from that function. The value is an IEnumerable of CLR objects. Using Jint this just works: I return the object and can foreach it etc, how do I do the same thing in IronJS (Why not use Jint, well it has bugs, for example it wont compile underscore.js)

EDIT: Since I am not a fluent F# person I cannot answer this question myself by reading the code. So instead I fixed Jint. However it would still be nice to know the answer

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥抱我好吗 2024-12-09 22:08:09

我们仍在致力于 .NET 互操作。因此,IronJS 中的 foreach 并未设置为枚举 IEnumerables,而是作用于 CommonObject 类型对象。

We are still working on our .NET interop. As such, the foreach in IronJS is not set up to enumerate IEnumerables, but instead works on CommonObject type objects.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文