[Ironpython-users] Passing an IronPython function to C#
jdhardy at gmail.com
Fri Mar 16 16:36:31 CET 2012
On Fri, Mar 16, 2012 at 4:24 AM, Doug Blank <doug.blank at gmail.com> wrote:
> This is looking more and more like a bug. I see from
> that it works for constructors (and have verified that it does), but I
> can't figure out any way to make it work with a static method. Why the
Well, it could just be a bug :), and I haven't investigated it at all,
so this is speculation. However, in the first method (the params 
one) the callables are being passed directly, while in the second
they're being converted as part of a list -> List<> conversion.
IronPython's conversion code is, um, interesting -- Dino might
understand it all, but I don't know if anyone else does -- so it's
possible two different sets of conversions are being chosen. Now, this
*shouldn't* be the case, but it's my hypothesis.
> If it is a bug, is there a workaround? How can I pass any Python
> callable to a C# static method?
Try the conversion on the Python side, manually:
f = System.Func[System.Object](test1)
More information about the Ironpython-users