using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq; public partial class delegatewith2arg : System.Web.UI.Page
{
public delegate void calculation(double a, double b); // define delegate
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnok_Click(object sender, EventArgs e)
{
calculation calc = sum; // invoke first method
calc += minus; //invoke second
calc += multiply; // third
calc += devide; // forth
calc.Invoke(double.Parse(txtfirstvalue.Text), double.Parse(txtsecondvalue.Text)); // pass value as arguemet
}
void sum(double x, double y) // first method
{
lblsum.Text = (x + y).ToString();
}
void minus(double x, double y) // second method
{
lblminus.Text = (x - y).ToString();
}
void multiply(double x, double y) // third method
{
lblmultiply.Text = (x * y).ToString();
}
void devide(double x, double y) //forth method
{
lbldevide.Text = (x / y).ToString();
}
}