[IronPython] Calling explicitly-implemented interface methods

Dino Viehland dinov at microsoft.com
Sat May 1 02:07:05 CEST 2010


Michael wrote:
> On 30/04/2010 23:58, Dino Viehland wrote:
> > Michael wrote:
> >
> >> On 30/04/2010 23:32, Dino Viehland wrote:
> >>
> >>> Michael wrote:
> >>>
> >>>
> >>>> Hey all,
> >>>>
> >>>> I'm porting the dotnet-integration document that comes with IronPython
> >>>> to Try Python. The following example doesn't work, because RegistryKey
> >>>> isn't available on Silverlight. Can anyone suggest a good alternative of
> >>>> an explicitly implemented interface method on a class in Silverlight?
> >>>>
> >>>>
> >>> One example might be Python file objects which also implement IDisposable.
> >>>
> >>>
> >>>
> >> That would be a really inconvenient example to pick, since in Try Python
> >> I patch __builtin__.file to be a custom type that reads / writes files
> >> to local storage. :-)
> >>
> >> Can you think of anything else?
> >>
> > It's kind of lame but Python lists explicitly implement IList.Remove.
> >
> 
> Hmm... although the following doesn't return None - meaning that it
> doesn't fit the pattern of the first example:
> 
> clr.GetClrType(list).GetMethod("Remove")
> 
> *dammit* :-)

Yeah, I think there's a separate non-explicit one as well because it's 
both an IList and an IList<object>.  

Is it Silverlight 4?  You could use System.Tuple[int] and 
IStructuralEquatable.



More information about the Ironpython-users mailing list