Tuesday, September 25, 2007

Ananoymous Delegate

Ananymous Delegate:

protected void Page_Load(object sender, EventArgs e)
{
btn1.Click += delegate
{
Response.Write("Bala");
};

}

Note:If you use ananoymous delegate no need of creating seprate method for button click.This is Dotnet framework 2.0 :

Out put :

Bala

Note:When you click on button you will get above msg(Bala)