Tuesday, September 25, 2007

Overview of Delegates(C#)


Definetion:Delegate is nothing but the pointing the function.

How to call method using Delegate:

delegate void getvalue(); //Above class you have to declare delegate
public partial class Global : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

getvalue test=new getvalue(testbala);
test();
}
protected void testbala()
{
Response.Write("Bala");
}

Output

Bala