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

using System.Threading;

namespace ConsoleTest
{

public delegate void EventHandler(string sInfo);

class Class1
{
public event EventHandler EventHandleTest;

public void Start()
{
if (EventHandleTest != null)
{
Thread.Sleep(1000);
EventHandleTest("完成进度20%");
Thread.Sleep(1000);
EventHandleTest("完成进度40%");
Thread.Sleep(1000);
EventHandleTest("完成进度60%");
Thread.Sleep(1000);
EventHandleTest("完成进度80%");
Thread.Sleep(1000);
EventHandleTest("完成进度100%");
}
}
}

class customEvent
{
static void Main()
{
Class1 c = new Class1();
c.EventHandleTest +=new EventHandler(c_EventHandleTest);
c.Start();
Console.ReadLine();
}

public static void c_EventHandleTest(string sInfo)
{
Console.WriteLine(sInfo);
}

}
}

运行结果:

event 自定义事件一例_null