programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Saturday, August 22, 2015

What is Delegates in C#, how to declare and use C# Delegates

What is Delegates in C#, how to declare and use C# Delegates:

Delegates in C#, how to declare:

In other programming language like C++, Pascal gives the facility of function pointer. Similar in C#(object-oriented language) use delegate. C# delegate enable encapsulate both an object and instance and a method. A delegate declaration defines a class that is derived from the class System.Delegate. A delegate instance encapsulates an invocations list, which is a list one or more method, each of which is referred to as callable entity.

A delegate defines a reference type that can be used to encapsulate a method with a specific signature.

C# delegate Life cycle:

The life cycle of C# delegate is
  • Declaration
  • Instantiation

C# delegate Declarations:

Delegate declaration is a type declaration that declare a new delegate type .


[modifier] delegate [return type][identifier]( formal parameters)


Public delegate int MYFirstDelegate(int i)


  • new
  • public
  • protected
  • internal
  • private

No comments:

Post a Comment