事件

namespace ConsoleApplication2
{
    delegate string Mydelegatetwo(int x, int y);
    class personone
    {
        public string test(int a, int b)
        {
            return "";
        }
        public event Mydelegatetwo MyEvent;
        public void funMyEvent()
        {
            MyEvent(1, 2);
        }
    }
    class 事件
    {
        public static void Main()
        {
            事件 事件01 = new 事件();
            事件01.M();
        }
        public void M()
        {
            personone p1 = new personone();
            p1.MyEvent += p1.test;
            p1.MyEvent += funthree;
            p1.funMyEvent();
        }
        public string funthree(int a, int b)
        {
            return "";
        }
    }
}
原文地址:https://www.cnblogs.com/bingguang/p/3164243.html