在python中使用C#代码 [英] using C# code in python

查看:297
本文介绍了在python中使用C#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在python中使用C#代码,所以想知道在python中使用#code的各种方法。任何人都可以建议我如何使用?

I want to use C# code in python so would like to know various methods to use # code in python. Can anybody please suggest me that How can I use ?

祝你好运

Mrutyunjaya

Mrutyunjaya

推荐答案

您无法从Python调用托管代码。通常,如果不使用COM或IPC,则无法从任何非托管语言调用托管代码。只有当它是另一个进程时,IPC才有效。如果语言支持COM并且您在C#中实现COM类,则COM可以工作。

You cannot call managed code from Python. In general you cannot call managed code from any unmanaged language without using COM or IPC. IPC only works if it is another process. COM works if the language supports it and you implement the COM class in C#.

有一些尝试集成这些语言。我建议你谷歌,但这里有一个I
找到。但请注意,这些是第三方解决方案,因此您需要得到他们的支持,而不是MSDN论坛,因为我们只支持MS产品。

There are some attempts to integrate the languages. I would recommend you google but here's one I found. Note however that these are third party solutions so you will need to get support from them instead of the MSDN forums as we only support MS products.

我还应该指出有管理称为
IronPython
的Python版本允许直接访问您的C#代码。但是,您需要使用IronPython而不是现在使用的任何Python运行时,在您的情况下可能会或可能不会。

I should also point out that there is a managed version of Python called IronPython that would allow direct access to your C# code. However you would need to use IronPython instead of whatever Python runtime you're using now which may or may not be doable in your case.


这篇关于在python中使用C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆