[IronPython] Who understands ByRef?

Dino Viehland dinov at exchange.microsoft.com
Mon Oct 16 22:59:24 CEST 2006

It's probably easier to use the Reference type from the clr module then using reflection to make a  by-ref type.

import clr
import System
ref = clr.Reference[System.Int16](3)
print ref.Value #value gets updated in the reference object

This is the other way we support reference types in addition to the auto-coercion which isn't working for you due to the multiple overloads.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of jeff sacksteder
Sent: Monday, October 16, 2006 1:37 PM
To: Discussion of IronPython
Subject: [IronPython] Who understands ByRef?

Can anyone enlighten me?
On 10/14/06, jeff sacksteder <jsacksteder at gmail.com<mailto:jsacksteder at gmail.com>> wrote:

On 10/13/06, Martin Maly < Martin.Maly at microsoft.com<mailto:Martin.Maly at microsoft.com>> wrote:

Int16 is a type: System.Int16 and I am calling its constructor, passing "output" as the value:  System.Int16(output), just like in Python you can call:  int(3.5), this is very similar, except constructing .NET System.Int16 type.

An excellent description. However-

"TypeError: no overloads of AIn could match (int, Range, Int16)
  AIn(int, Range, Reference[Int16])
  AIn(int, Range, Reference[UInt16])"

I think I should be using System.Type.MakeByRefType, but I'm not quite getting it.

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

More information about the Ironpython-users mailing list