How can I implement static methods on an interface?

前端 未结 8 1908
生来不讨喜
生来不讨喜 2020-12-07 21:26

I have a 3rd party C++ DLL that I call from C#.

The methods are static.

I want to abstract it out to do some unit testing so I created an interface with the

8条回答
  •  一整个雨季
    2020-12-07 22:06

    You could invoke it with reflection:

    MyInterface.GetType().InvokeMember("StaticMethod", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null, null, null);
    

提交回复
热议问题