假设我用一个类构建了一个程序集:
public class Foo
{
public void Bar()
{
// If we're being called from IronPython, IronRuby, etc... do one thing
// If not, print some message. Or something.
}
}
然后,从 ipy.exe:
import clr
clr.AddReference('ThatAssembly.dll')
from ThatAssemblyNamespace import Foo
a = Foo()
a.Bar()
如何判断我的 Bar 方法是否在 ScriptingRuntime 中运行?是否可以向该运行时发出回调(重新进入)?