C
Curious
Hi,
A typical way of using delegates, for example, is:
class MyForm
{
void Button1.Click += new EventHandler (Action1);
void Button1.Click += new EventHandler (Action2);
void Button1.Click += new EventHandler (Action3);
}
This is equivalent to the following:
class MyForm
{
void Button1.Click()
{
Action1;
Action2;
Action3;
}
}
Therefore, delegates can be replaced by regular method calls. I don't
see the need to use delegates. Anyone could explain why use them?
A typical way of using delegates, for example, is:
class MyForm
{
void Button1.Click += new EventHandler (Action1);
void Button1.Click += new EventHandler (Action2);
void Button1.Click += new EventHandler (Action3);
}
This is equivalent to the following:
class MyForm
{
void Button1.Click()
{
Action1;
Action2;
Action3;
}
}
Therefore, delegates can be replaced by regular method calls. I don't
see the need to use delegates. Anyone could explain why use them?