Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python调用c#接口_C#_Python_Interface - Fatal编程技术网

python调用c#接口

python调用c#接口,c#,python,interface,C#,Python,Interface,C#library中有一个接口,我正试图在Python中使用它 这是我在c#中使用它的方式: 问题是如何使用c#dll中的c#接口在python中启动相同的服务? 同样的,我也想在python中实现。Python代码如下: import sys sys.path.append(r"C:\Program Files\foldername") import clr clr.AddReference(r"C:\Program Files\foldername\MyDll.MyClass") from

C#library中有一个接口,我正试图在Python中使用它

这是我在c#中使用它的方式:

问题是如何使用c#dll中的c#接口在python中启动相同的服务? 同样的,我也想在python中实现。Python代码如下:

import sys
sys.path.append(r"C:\Program Files\foldername")
import clr
clr.AddReference(r"C:\Program Files\foldername\MyDll.MyClass")
from MyDll.MyClass import MyClass

def OnRun(self, userExcInst):
    myInterface = MyClass()
    myInterface = (IMyClassInterface)myclas.GetService(computer, port, MyClass.ServiceName.RUNTIME_CONTROL); #??? This is what I am trying to implement

因此,我想在python中使用c#dll启动服务

我想你需要的是使用,你可以在c#上创建你的库,然后从你的python服务/脚本调用我想你需要的是使用,你可以在c#上创建你的库,然后从你的python服务/脚本调用
import sys
sys.path.append(r"C:\Program Files\foldername")
import clr
clr.AddReference(r"C:\Program Files\foldername\MyDll.MyClass")
from MyDll.MyClass import MyClass

def OnRun(self, userExcInst):
    myInterface = MyClass()
    myInterface = (IMyClassInterface)myclas.GetService(computer, port, MyClass.ServiceName.RUNTIME_CONTROL); #??? This is what I am trying to implement