Does python .net support creating a class inherited from an interface class declared by c#?
Hi There, I want to create a class which can be inherited from an interface class declared by c#. But it throws TypeError when I instance it: "object does not implement IServiceCallbackContract". class ServiceCallbackContract(IServiceCallbackContract): def __init__(self, c): pass object = ServiceCallbackContract(AClass) Then I added some debug messages in the Python.Net source code. [cid:image001.png@01D07C84.4EA703C0] I mean I want to create a class as the implementation of the interface class which is declared by C# in a DLL file, I'm unable to change the code in that DLL file. So is there any way to make it works for my purpose by python.net? Thanks, Best regards, Oscar Le
Does this work in Ironpython? On Tue, Apr 21, 2015, 10:33 AM Oscar Le <Oscar.Le@software.dell.com> wrote:
Hi There,
I want to create a class which can be inherited from an interface class declared by c#. But it throws TypeError when I instance it: “object does not implement IServiceCallbackContract”.
*class ServiceCallbackContract(IServiceCallbackContract):*
* def __init__(self, c):*
* pass*
*object = ServiceCallbackContract(AClass)*
Then I added some debug messages in the Python.Net source code.
I mean I want to create a class as the implementation of the interface class which is declared by C# in a DLL file, I’m unable to change the code in that DLL file. So is there any way to make it works for my purpose by python.net?
Thanks,
Best regards,
*Oscar Le*
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
This is one of the features I added to this fork: https://github.com/renshawbay/pythonnet It's not yet integrated into the main repo, but you can build it from the source in github. Take a look at the test_subclass.py unit test here: https://github.com/renshawbay/pythonnet/blob/python3/src/tests/test_subclass... Tony On Tue, Apr 21, 2015 at 4:56 PM Denis Akhiyarov <denis.akhiyarov@gmail.com> wrote:
Does this work in Ironpython?
On Tue, Apr 21, 2015, 10:33 AM Oscar Le <Oscar.Le@software.dell.com> wrote:
Hi There,
I want to create a class which can be inherited from an interface class declared by c#. But it throws TypeError when I instance it: “object does not implement IServiceCallbackContract”.
*class ServiceCallbackContract(IServiceCallbackContract):*
* def __init__(self, c):*
* pass*
*object = ServiceCallbackContract(AClass)*
Then I added some debug messages in the Python.Net source code.
I mean I want to create a class as the implementation of the interface class which is declared by C# in a DLL file, I’m unable to change the code in that DLL file. So is there any way to make it works for my purpose by python.net?
Thanks,
Best regards,
*Oscar Le*
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
participants (3)
-
Denis Akhiyarov
-
Oscar Le
-
Tony Roberts