C# Python for.NET:如何使用反射调用静态类的方法?

C# Python for.NET:如何使用反射调用静态类的方法?,c#,python,.net,python.net,pythonnet,C#,Python,.net,Python.net,Pythonnet,我想使用一个静态类的方法 这是我的C#代码: 如果它是一个“普通”类,我可以使用SomeMethodlike lib = clr.AddReference('c:\\Test\Module.dll') from System import Type type1 = lib.GetType('SomeNamespace.SomeClass') constructor1 = type1.GetConstructor(Type.EmptyTypes) my_instance = construct

我想使用一个静态类的方法

这是我的C#代码:

如果它是一个“普通”类,我可以使用
SomeMethod
like

lib = clr.AddReference('c:\\Test\Module.dll')
from System import Type
type1 = lib.GetType('SomeNamespace.SomeClass')
constructor1 = type1.GetConstructor(Type.EmptyTypes)  
my_instance = constructor1.Invoke([])  
my_instance.SomeMethod() 
但是当我尝试用静态类来做这件事时

MissingMethodException: "Cannot create an abstract class.

我如何解决这个问题?

多亏了对这个问题的评论,我才能够使用


静态方法不是类实例/对象的一部分,也就是说,调用静态方法不必使用构造函数创建实例,下面是调用静态方法的示例,我猜类似于
type1.GetMethod(“SomeMethod”)
而不是
GetConstructor
。在我的一个类似问题中可以找到更多相关信息
MissingMethodException: "Cannot create an abstract class.
lib = clr.AddReference('c:\\Test\Module.dll')
from System import Type
my_type = lib.GetType('SomeNamespace.SomeClass')
method = my_type.GetMethod('SomeMethod')  

# RetType is void in my case, so None works
RetType = None
# parameters passed to the functions need to be a list
method.Invoke(RetType, [param1, param2])