[IronPython] The return value (out)

Dino Viehland dinov at microsoft.com
Sat Mar 26 06:44:30 CET 2011

Is the method overloaded?  There could be enough confusion w/overloads where we aren't picking the right overload.  Alternately you can do:

import clr
ref = clr.Reference[TPick]()

And then call it with the reference value whose's .Value property will be updated on a successful call such as:

int_res = EntityPick(ref, ...)
print ref.Value

If it is overloaded you can also index into the .Overloads property to select the proper overload but hopefully using Reference (which is an alias for StrongBox) should work.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Afan Olovcic
Sent: Friday, March 25, 2011 7:24 PM
To: Discussion of IronPython
Subject: Re: [IronPython] The return value (out)


It doesn't work I have an error message

Microsoft.Scripting.ArgumentTypeException: expected StrongBox[TPick], got TMesh


result, pick = LE.EntityPick(entity,10.0)

On Sat, Mar 26, 2011 at 3:13 AM, Tomas Matousek <Tomas.Matousek at microsoft.com<mailto:Tomas.Matousek at microsoft.com>> wrote:
This should work:

result, pick = EntityPick(entity)

That is, out arguments are returned bundled in a tuple with the result of the method.


From: users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> [mailto:users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com>] On Behalf Of Afan Olovcic
Sent: Friday, March 25, 2011 6:56 PM
To: users at lists.ironpython.com<mailto:users at lists.ironpython.com>
Subject: [IronPython] The return value (out)


Can somebody help me to solve this problem please ?

in the .NET Assembly there is C# function:
public static extern int EntityPick(out TPick pick, TEntity entity, float range = 100, float radius = 0, int collisionType = 0, PickFilterCallback pickfilter = null);

how to call that function in ironPython and get return value of pick

I can't find working solution


Users mailing list
Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110326/d4c2b422/attachment.html>

More information about the Ironpython-users mailing list