using System;
public delegate void LogEventHandler(object source, LogEventArgs args);
public class EventDemo
{
public event LogEventHandler logEvent;
public void Do()
{
logEvent(this,new LogEventArgs());
Console.WriteLine("Ok.");
}
}
public class LogEventArgs : EventArgs
{
public LogEventArgs()
{}
}
public class App
{
public static void Main()
{
EventDemo eventDemo =new EventDemo();
eventDemo.logEvent += new LogEventHandler(WriteLog);
eventDemo.Do();
}
public static void WriteLog(object sender,LogEventArgs le)
{
Console.WriteLine("In Event :Write Done. ");
}
}