[IronPython] Implementing an interface with ref parameters

Dody Gunawinata empirebuilder at gmail.com
Sat Aug 18 07:28:34 CEST 2007


Great. It works now. Thank you.

public interface IContent
{
   void BeginProcess(ref bool captureContent);
   void EndProcess(string content);
}

class ImageGallery(IContent):
    def BeginProcess(captureContent):
        captureContent.Value = False # Now works


On 8/18/07, Dino Viehland <dinov at exchange.microsoft.com> wrote:
>
>  I believe what we should be doing is passing you a Reference<T> object
> where T in this case is bool.  The Reference<T> object has a Value property
> which you can set and when you return the ref parameter should get updated.
>
>
>
> Let me know if that doesn't work for you.
>
>
>
> *From:* users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] *On Behalf Of *Dody Gunawinata
> *Sent:* Friday, August 17, 2007 5:09 AM
> *To:* users at lists.ironpython.com
> *Subject:* [IronPython] Implementing an interface with ref parameters
>
>
>
> Hi all,
>
> I'm trying to implement a C# interface with methods that contains ref
> parameter, eg:
>
> public interface IContent
> {
>    void BeginProcess(ref bool captureContent);
>    void EndProcess(string content);
> }
>
> A straight implementation will not work because IronPython does not modify
> the captureContent value
>
> class ImageGallery(IContent):
>     def BeginProcess(captureContent):
>         captureContent = False # This doesn't work.
>
>
>
> --
> nomadlife.org
>



-- 
nomadlife.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070818/2bcfe51a/attachment.html>


More information about the Ironpython-users mailing list