Invoking/Creating Delegate
Good Day Everyone,
there are 2 ways I've noticed I can invoke/create delegate either
MrDel MyDelegate = new MrDel(Mathmetics.Method);
or
MrDel MyDelegate = Mathmetics.Method;
So my question is whats the difference between those 2 ways? Why Would I
need to use first one if second one is much shorter to type and they
seemingly doing the same thing? By going through some of the tutorials I'm
seeing ppl either using first way or second way but they don't realy
explaining WHY. Could you help me make it clear or point out where I can
read about it, thank you.
FULL CODE:
class Program
{
public delegate void MrDel(int arg, ThingsToDo e);
static void Main(string[] args)
{
MrDel MyDelegate = new MrDel(Mathmetics.Method);
//MrDel MyDelegate = Mathmetics.Method;
Method(MyDelegate);
Console.Read();
}
No comments:
Post a Comment