[Python.NET] Casting an object to a different interface

"Matthias Hillenbrand" <[email protected]>
Newsgroups gmane.comp.python.dotnet
Message-ID <[email protected]>
Hi,

 

The Python win32com module for accessing COM objects provides a method
CastTo for casting an object to a different interface.

Similarly, in my application, I have to cast an object to another .Net
interface. Does  Python.Net provide such a method or can you describe a way
of doing the casting using C# libraries?

 

Here is a small example:

I have an object of type ILDERow and want to cast it to
ISurfaceCoordinateBreak. Using win32com this can be done in the following
way:

from win32com.client import CastTo

cbSurface = CastTo(surface, "ISurfaceCoordinateBreak")

 

Thank you very much!

 

Best regards,

Matthias

_________________________________________________
Python.NET mailing list - [email protected]
https://mail.python.org/mailman/listinfo/pythondotnet
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.