Aug 21

C# Simple Delegate Example

C# Simple Delegate Example

A delegate in C# is similar to a function pointer in C or C++. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked.

Below C# Program Displays Results using Delegates. Here Delegate is a type which holds the method(s) reference in an object. It is also referred to as a type safe function pointer.

Result for above code is :

Permanent link to this article: http://zappmania.in/2016/08/21/c-sharp-simple-delegate-example.htm

Leave a Reply

Your email address will not be published.