How To Work With Delegates In C# Simple Example For Beginners
public delegate int mob(int ac);
public int doubles(int ac)
{
return ac * 2;
}
public int square(int ac)
{
return ac * ac;
}
public int doubles(int ac)
{
return ac * 2;
}
public int square(int ac)
{
return ac * ac;
}
private void Delegate_Btn_Click(object sender, EventArgs e)
{
//Delegates//
mob c = doubles;
label4.Text = c(20).ToString();
int cde = 20 + 30;
label5.Text = cde.ToString();
mob d = square;
label6.Text = d(9).ToString();
//--------------------------//
}
{
//Delegates//
mob c = doubles;
label4.Text = c(20).ToString();
int cde = 20 + 30;
label5.Text = cde.ToString();
mob d = square;
label6.Text = d(9).ToString();
//--------------------------//
}
No comments:
Post a Comment