using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    
class Program
    {
        
public delegate void del(); //声明委托
        public event del shout;//声明事件

        
public void send()   //方法1
        {
            Console.WriteLine(
"好,");
        }

        
public void send2()  //方法2
        {
            Console.WriteLine(
"好呀!");
        }

        
//事件
        public void CallMe(string s)
        {
            Console.WriteLine(
"我来了!" + s);
            
if (shout != null)
            {
                shout();   
//事件的参数应和委托一样
            }
        }


        
static void Main(string[] args)
        {
            Program p 
= new Program();   //实例化Program的一个实例
            p.shout += new Program.del(p.send); //将send方法实例到委托并登记到事件中
            p.shout += new Program.del(p.send2);//将send2方法实例到委托并登记到事件中
            p.CallMe("现在");   //调用事件
            Console.ReadLine();
        }
    }
}