1. 程式人生 > >委托 多播

委托 多播

gate div main png ext line .text wms style

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"); } } }

顯示

技術分享

委托 多播