Am studying about delegates. As I read. I learned that adding more than one function in a delegate is called multicast delegate. Based on that I wrote a program. Here two functi
Actually all delegates in C# are MulticastDelegates, even if they only have a single method as target. (Even anonymous functions and lambdas are MulticastDelegates even though they by definition have only single target.)
MulticastDelegate
is simply the base class for all kinds of function or method references in C#, whether they contain one or more targets.
So this:
MyDelegate myDel = new MyDelegate(AddNumbers);
Sets myDel
to a MulticastDelegate
with a single target. But this line:
myDel += new MyDelegate(MultiplyNumbers);
Updates myDel
to a MulticastDelegate
with two targets.