Hi, Tom,
Von: Tom Unger
> But I want to eliminate the need for each script to do that import by setting
> up the scope with:
> scriptScope.SetVariable("App", App);
> This does not compile because App is a static class, not an object.
Maybe scriptScope.SetVariable("App",
DynamicHelpers.GetPythonTypeFromType(typeof(App))) can help here?
The C# typeof() operator returns the .NET type object (the same as you get from
GetType() of an instance), and the DynamicHelpers.GetPythonTypeFromType()
method returns the corresponding python type object for that .NET type.
I successfully used it to expose types (constructors, static members) to
IronPython 2.6 scripts.
(DynamicHelpers is defined in the IronPython.Runtime.Types namespace.)
HTH,
Markus
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com