How to import a static class (or static method) into IronPython (or DLR) using C # code (not python)?

scope.SetVariable ("math", typeof (System.Math) ??);

or do i need a module?

+5
source share
1 answer

You can do:

scope.SetVariable ("math", DynamicHelpers.GetPythonTypeFromType (typeof (System.Math)));

DynamicHelpers is located in IronPython.Runtime.Types.

+6
source

All Articles