Aug 21

Print this Post

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://www.zappmania.in/2016/08/21/c-sharp-simple-delegate-example.htm

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">