It should just work in the next release :). There are problems with it right now but I checked in a fix to make this work last week.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Eloff Sent: Sunday, July 13, 2008 6:12 PM To: Discussion of IronPython Subject: Re: [IronPython] Add/remove python function to C# event in C# On Sun, Jul 13, 2008 at 7:20 PM, Dino Viehland <[EMAIL PROTECTED]> wrote: > Ahh I see what you mean now. If you're doing this from the hosting APIs you > can use the ObjectOperations class to do the conversion: > > someObj.someEvent += objOps.ConvertTo<DelegateType>(obj); That is disturbingly easy. I knew you'd know the answer. But I wonder if that would work for removing a handler from an event? someObj.someEvent += objOps.ConvertTo<DelegateType>(obj); someObj.someEvent -= objOps.ConvertTo<DelegateType>(obj); One workaround might be to cache the delegate on the way in and use the cached delegate to remove it. _cache[obj] = objOps.ConvertTo<DelegateType>(obj); someObj.someEvent += _cache[obj] someObj.someEvent -= _cache[obj] But maybe there's a better way, or maybe I'm daft and it'll just work. -Dan _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
