static void Display(object source,EventArgs e)
{
Console.WriteLine("You are a pig!");}
改成
static void Display(string kkk)
{   
Console.WriteLine("You are a pig!");
Console.WriteLine(kkk);}

解决方案 »

  1.   

    你的委派的类型和你要委派的方法的参数不匹配
    static void Display(object source,EventArgs e)
    {
    Console.WriteLine("You are a pig!");}改为
    static void Display(string Message)
    {
    Console.WriteLine("You are a pig!");}
      

  2.   

    或者:
    public delegate string myEventHandler(string Message);//建立委托改成:
    public delegate string myEventHandler(object sender,EventArgs e);//建立委托
      

  3.   

    using System;namespace ConsoleApplication7
    {
    public delegate void myEventHandler(string Message,EventArgs e);//建立委托
    class EventClass
    {
    public event myEventHandler myEvent;
    static void Display(string source,EventArgs e)
    {
    Console.WriteLine("You are a pig!");
    }

    static void Main(string[] args)
    {
    EventClass myEventClass=new EventClass();
    myEventClass.myEvent+=new myEventHandler(Display);
    }
    }}