[IronPython] howto access interface method?

J. Merrill jvm_cop at spamcop.net
Tue Feb 21 22:00:22 CET 2006


Would it be reasonable to use syntax
     this.DataGridView1[ISupportInitialize].BeginInit
to do the equivalent of "casting to an interface" in IP?

At 11:55 AM 2/16/2006, Dino Viehland wrote
>The issue here is that the interface's methods are marked private, but are exposed publicly via the interface (aka explicit interface implementation) -hence the reason you need the cast in C#.
>
>This is a shortcoming we're aware of but we don't have a bug on it.  I'll go ahead and file a bug on this so it doesn't get lost.  The fix may be a little complex for this one so it may not make it for beta 4 but I'll initially open it as a beta 4 bug so we'll give it a shot.
>
>
>-----Original Message-----
>From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Chee Meng
>Sent: Thursday, February 16, 2006 12:58 AM
>To: users at lists.ironpython.com
>Subject: [IronPython] howto access interface method?
>
>
>hi,
>
>I am using the DataGridView object which implements the interface ISupportInitialize,
>and that have 2 methods BeginInit and EndInit .
>
>However, through Ironpython,
>the 2 methods cannot be found.
>
>is there a way to access the 2 methods in python?
>
>#((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
>this.dataGridView1.BeginInit()
>
>above code gives this error, AttributeError: 'DataGridView' object has no attribute 'BeginInit'
>
>
>thks
>
>
>regards
>cheemeng


J. Merrill / Analytical Software Corp




More information about the Ironpython-users mailing list