Freigeben über


Primer - Delegates in J#

Primer - Delegates in J#

 

In next couple of posts i will discuss about delegates in J# starting from basic introduction, different types, and finally discuss some examples around delegates.

 

Here is the first section of this primer...As always feel free to send in your comments, questions and feedback!

 

Delegates in J#

    Delegates are .NET version of the callback function. Unlike callback mechanism used in other platforms such as C/C++, delegates offer much more functionality. For example in Unmanaged C/C++, the address of a function is just a memory address. This address doesn’t carry along any information, such as the number of parameters the function expects, the types of these parameters, the functions return value type, and the functions calling convention. In short, unmanaged C/C++ callback functions are not type safe.

    However, Delegates in .NET ensures that the callback method is type safe and it also integrates the ability to call the multiple methods serially and support calling of static methods as well as instance methods.

    It needs to be noted that delegates are compiled into classes and hence the instances of delegates are treated like any other class instance.

Two Different Delegates types in J#

 

    It needs to be noted that in case of J# the binding of delegates is done at runtime (shall talk more on this later). It also needs to be noted that when we use the delegate and the multicast delegate keywords to declare single cast and multicast delegate in J#, the delegates that are created may be of the type com.ms.lang.Delegate or of the type System.Delegate depending on the declaration of the delegate.

 

In the next post, i will go in more details and talk about delegates derived from com.ms.lang.Delegate...

Comments

  • Anonymous
    March 17, 2006
    While I was trying to write a blog around the topic of Delegates in J#, I found that a few blogs have...

  • Anonymous
    February 05, 2007
    Hi! mazda cx7, mazda cx 7,2007 mazda cx 7,mazda cx 7 review, mazda rev it up, zoom mazda, mazda official site, mazda cx7 review , mazda cx7 reviews, mazda north american operations, mazda cx 7 canada, mazda cx 7 road test, mazda cx 7 forum, mazda cx7 road test, 2007 mazda cx 7 review, mazda cx 7 pictures, 2006 mazda cx 7, mazda cx7 canada, mazda cx 7 release, mazda cx 7 release date, mazda cx7 test, mazda cx 7 video, new mazda cx 7, mazada cx7, mazda cx 7 news, mazda cx 7 wallpaper, mazda cx 7 suv, mazda cx 7 pricing,mazda cx 7 trip computer, mazda cx7 specs, mazda cx 7 availability, mazda cx 7 specifications, mazda cx 7 crossover

  • Anonymous
    February 05, 2007
    Hi! mazda cx7, mazda cx 7,2007 mazda cx 7,mazda cx 7 review, mazda rev it up, zoom mazda, mazda official site, mazda cx7 review , mazda cx7 reviews, mazda north american operations, mazda cx 7 canada, mazda cx 7 road test, mazda cx 7 forum, mazda cx7 road test, 2007 mazda cx 7 review, mazda cx 7 pictures, 2006 mazda cx 7, mazda cx7 canada, mazda cx 7 release, mazda cx 7 release date, mazda cx7 test, mazda cx 7 video, new mazda cx 7, mazada cx7, mazda cx 7 news, mazda cx 7 wallpaper, mazda cx 7 suv, mazda cx 7 pricing,mazda cx 7 trip computer, mazda cx7 specs, mazda cx 7 availability, mazda cx 7 specifications, mazda cx 7 crossover

  • Anonymous
    August 01, 2008
    PingBack from http://dayton.freevideonewsradio.info/mazdacx7canada.html

  • Anonymous
    June 16, 2009
    PingBack from http://lowcostcarinsurances.info/story.php?id=7154