将静态方法添加到 IronPython 范围
假设我有以下代码:
public static class Foo
{
public static void Bar() {}
}
在 IronPython 中,我希望:
Bar()
不必包含 Foo 就行了。现在,我知道我可以说:
var Bar = Foo.Bar
Bar()
但我想使用 SetVariable 将 Bar 添加到我的 C# 代码中的 ScriptScope。我该怎么做?
Assume I have the following code:
public static class Foo
{
public static void Bar() {}
}
In IronPython, I would like to have:
Bar()
Without having to include the Foo on the line. Now, I know I can say:
var Bar = Foo.Bar
Bar()
But I would like to add Bar to the ScriptScope in my C# code using SetVariable. How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建方法委托并设置范围。
Create delegate to method and set in to scope.