Tomas Matousek wrote:

We’ve made change recently (last week) on .NET 2.0 you’ll need to use a different namespace and assembly:

import clr

clr.AddReference(‘Microsoft.Scripting’)

from Microsoft.Scripting.Utils import Func

Func[object, object](targetCallableHere)


Will this work cross-version? (i.e. will it also work on .NET 3 & 4?)

Michael

Tomas

*From:* users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Michael Foord
*Sent:* Monday, September 14, 2009 11:04 AM
*To:* Discussion of IronPython
*Cc:* Discussion of IronPython
*Subject:* Re: [IronPython] CallTargetX delegates

--

http://www.ironpythoninaction.com


On 14 Sep 2009, at 18:59, Dino Viehland <di...@microsoft.com <mailto:di...@microsoft.com>> wrote:

    To use Func you just need to do:

    import clr

    clr.AddReference(‘System.Core’)

    from System import Func

    Func[object, object](targetCallableHere)

    This is equivalent to CallTarget1.  You can add more “object, “ or
    you can replace object with some other type.

It is of course dependent on .NET 3.

Michael



*From:* users-boun...@lists.ironpython.com <mailto:users-boun...@lists.ironpython.com> [mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Brian Curtin
*Sent:* Monday, September 14, 2009 10:53 AM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] CallTargetX delegates

How would someone replace CallTargetX with Func<...> within a script? For example, how would you change the Invoke calls in onChanged and onRenamed here: http://www.ironpython.info/index.php/Invoking_onto_the_GUI_%28Control%29_Thread

I've never seen how to use Func within an IP script, just within C#.


On Wed, Sep 2, 2009 at 04:59, Davy Mitchell <daftspan...@gmail.com <mailto:daftspan...@gmail.com>> wrote:

Could someone pop an example of this on http://www.ironpython.info?
Sounds like it could be a common 'gotcha' especially for newbies
running old example code.

Cheers,
Davy


On Wed, Sep 2, 2009 at 6:38 AM, David Escobar<davidesco...@ieee.org <mailto:davidesco...@ieee.org>> wrote:
> Ok cool. I've used Func<> from C# before. That did the trick. Thanks.
>
>
> On Tue, Sep 1, 2009 at 6:19 PM, Dino Viehland <di...@microsoft.com <mailto:di...@microsoft.com>> wrote:
>>
>> Yes.  CallTarget’s were really a part of IronPython’s internal calling
>> convention for used defined functions. We kept CallTarget0 around because
>> we knew lots of users had come to depend on that one when they needed a
>> delegate type. But we removed all the others and switched to using Func<…>
>> internally.  Ideally you can switch to using Func<> as well.
>>
>>
>>
>> From: users-boun...@lists.ironpython.com <mailto:users-boun...@lists.ironpython.com> >> [mailto:users-boun...@lists.ironpython.com <mailto:users-boun...@lists.ironpython.com>] On Behalf Of David Escobar
>> Sent: Tuesday, September 01, 2009 5:41 PM
>> To: Discussion of IronPython
>> Subject: [IronPython] CallTargetX delegates
>>
>>
>>
>> In IronPython 2.6 beta 2, did the CallTargetX delegates get moved to
>> another module or were they simply removed altogether? The only delegate in >> IronPython.Compiler is CallTarget0. I checked IronPython 2.0.2 and it has up
>> to CallTarget16.
>

> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com <mailto:Users@lists.ironpython.com>
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>



--
--
 Davy Stuff  - http://daftspaniel.blogspot.com
 Geeky Stuff  - http://daftpython.blogspot.com
Davy's Ironpython Editor - http://code.google.com/p/davysironpythoneditor/
_______________________________________________
Users mailing list
Users@lists.ironpython.com <mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

    _______________________________________________
    Users mailing list
    Users@lists.ironpython.com <mailto:Users@lists.ironpython.com>
    http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

------------------------------------------------------------------------

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to