简体   繁体   English

如何使用C#代码(而非python)将静态类(或静态方法)导入IronPython(或DLR)?

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

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

or do I need create a module? 还是我需要创建一个模块?

You can do: 你可以做:

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

DynamicHelpers is in IronPython.Runtime.Types. DynamicHelpers在IronPython.Runtime.Types中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM