using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public class EventTest
{
public delegate void MyFunc(object sender, EventArgs e);
public event MyFunc myFunc;
public MyEvent myEvent;
public EventTest()
{
myEvent = new MyEvent();
myFunc += new MyFunc(myEvent.MyEventFunc);
}
protected void OnMyEvent(EventArgs e)
{
myFunc(this, e);
}
static void Main(string[] args)
{
EventTest test = new EventTest();
EventArgs e = new EventArgs();
test.OnMyEvent(e);
}
}
public class MyEvent
{
public void MyEventFunc(object sender, EventArgs e)
{
Console.WriteLine("this is my event");
}
}
}