In this article, I will brief about delegates and events. C# delegates are similar to pointers to functions, in C or C++. A delegate is a reference type variable that holds the reference to a method. The reference can be changed at runtime. Delegates are especially used for implementing events and the call-back methods. All delegates are implicitly derived from the System.Delegate class.
Declaring, Instantiating and Multicasting of delegates
Below screen shot explains, void vs return type delegates
Events and delegates work hand-in-hand to provide a program’s functionality. Below code shows logging feature using event delegate.
Declaring, Instantiating and Multicasting of delegates
Below screen shot explains, void vs return type delegates
Events and delegates work hand-in-hand to provide a program’s functionality. Below code shows logging feature using event delegate.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.