[IronPython] howto access interface method?
Dino Viehland
dinov at exchange.microsoft.com
Tue Feb 21 22:10:27 CET 2006
It's an interesting idea, but I think it'll end up conflicting w/ generics. What happens if I have a class that explicitly implements an interface that has BeginInit on it and defines a BeginInit<T> method? We won't know which one we should bind to.
My current thoughts on this are self.DataGridView1.ISupperInitialize_BeginInit. It's more verbose then I'd like it, but it also avoids versioning problems (where someone could add "BeginInit" in a later version and suddently you're calling something different).
Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)
-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J. Merrill
Sent: Tuesday, February 21, 2006 1:00 PM
To: Discussion of IronPython
Subject: Re: [IronPython] howto access interface method?
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
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
More information about the Ironpython-users
mailing list