using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 多播委托 { public delegate void Dele(); class Program { static void Main(string[] args) { Dele del = showMsg1; del += showMsg2; del += showMsg3; del += showMsg4; del -= showMsg1; del -= showMsg3; del(); Console.ReadKey(); } public static void showMsg1() { Console.WriteLine("T1"); } public static void showMsg2() { Console.WriteLine("T2"); } public static void showMsg3() { Console.WriteLine("T3"); } public static void showMsg4() { Console.WriteLine("T4"); } } }
显示