我正试图进入Microsoft.Signal库,其中一些Hub(IHubProxy)的实现在一个扩展中:HubProxyExtensions
pythonfor.Net在自述文件中似乎没有包含扩展,我也找不到任何参考(我的googlefu在本例中不起作用)
我可以直接加载extensions类,但调用方法失败:
ext = SignalR.Client.HubProxyExtensions
ext.On(self._proxy, method, handle)
扩展类作为一个元类加载和报告,并具有来自即时窗口的方法
^{pr2}$调用ext.On()
会使进程崩溃。在
pythonfor.Net是否支持扩展?(或者它只是特定于这个特定实现的问题)
更新:在扩展上做一个简单的测试,看起来pythonfor.Net确实正确地处理了扩展,所以我对Signalr的调用有问题。。。更多的测试即将到来。在
所以我要回答我自己的问题,因为这是多个问题;我没有看到其他人直接解决这个问题。在
操作模板:
在我的例子中,问题是没有办法在pythonfor.Net中绑定操作模板。因此,在集线器中无法调用正确的On方法。在
Someone else found the same issue recently
扩展:
Python for.Net可以调用扩展方法;只需像其他静态类方法一样通过扩展类调用静态扩展方法。在
C#
Python:
^{pr2}$输出:
我不知道为什么python for.net的自述文件中没有提到这一点。在
我想这很明显:)
相关问题 更多 >
编程相关推荐