[IronPython] c# function that passes arguments by reference

Dino Viehland dinov at exchange.microsoft.com
Fri Aug 25 22:06:12 CEST 2006

This is the "easy" way to call functions that are passing values by reference.  You should be able to pass non-zero values as well as non-empty arrays.  The only thing that should disallow this is if there were multiple overloads that resulted in an ambiguous method resolution.

For these cases there is a generic Reference type defined in the CLR module.  You can use this:

import clr
x = clr.Reference[int](3)


print x.Value

and Value will be updated after the call.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Frank Kampas
Sent: Friday, August 25, 2006 12:58 PM
To: users at lists.ironpython.com
Subject: [IronPython] c# function that passes arguments by reference

If I import a c# function that passes its arguments (integers and arrays)
by reference, the only way I can get it to work is pass zeroes for the integers and
arrays of zero for the arrays.  The results for the variables passed by reference return with the function
return.  Is that what is supposed to occur?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060825/1e93842f/attachment.html>

More information about the Ironpython-users mailing list