Multicast Delegate
It is a delegate which holds the reference of more than one method. Multicast delegates must contain only methods that return void. If we want to call multiple methods using a single delegate all the methods should have the same IO Parameters. To test this, add a new class MultiCastDemo.cs under the project and write the following code:
class MultiCastDemo { public void Add(int x, int y) { Console.WriteLine("Add: " + (x + y)); } public void Sub(int x, int y) { Console.WriteLine("Sub: " + (x - y)); } public void Mul(int x, int y) { Console.WriteLine("Mul: " + (x * y)); } public void Div(int x, int y) { Console.WriteLine("Div: " + (x / y)); } static void Main() { MultiCastDemo mc = new MultiCastDemo(); MathDel md = mc.Add; md += mc.Sub; md += mc.Mul; md += mc.Div; md(100, 50); Console.WriteLine(); md(575, 25); Console.WriteLine(); md -= obj.Mul; md(678, 28); Console.ReadLine(); } }