Roc Ho
Roc Ho

Reputation: 305

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

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

or do I need create a module?

Upvotes: 5

Views: 2031

Answers (1)

Dino Viehland
Dino Viehland

Reputation: 6486

You can do:

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

DynamicHelpers is in IronPython.Runtime.Types.

Upvotes: 7

Related Questions