views:

507

answers:

1

The FAQ which comes with the IronPython 2.0.1, lists the following:

You can define interfaces in C#, build those into a DLL, and then implement those interfaces in Python code as well as pass the python objects that implement the interfaces to C# code.

I have googled and googled and googled, but not found how to do this. Can someone help?

Thanks,

Rohit

+5  A: 

I'm not sure of this, but it looks like you could do it with the regular inheritance syntax of python:

class SomeClass (ISomeInterface):
    def SomeMethod(self, parameter):
        pass

EDIT: Ok, I just tested it and confirmed that you can implement an interface in IronPython this way. Just "inherit" the interface, implement its methods as you would any other class method, and enjoy!

Neil Williams