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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            ProcessTime p = new ProcessTime();

            Mytime t = new Mytime();

            t.Timer += new TimeEventHandler(p.GenerateTime);//To link events and event handling

            t.OnTimer("Mindstick");   //use event

            Console.Read();
        }
    }
    public delegate void TimeEventHandler(string s); //declare a delegate

    public class Mytime
    {

        public event TimeEventHandler Timer; //declare a event

        public void OnTimer(string s)
        {

            if (null != Timer)
            {

                Timer(s);  //raise the event

            }

        }

    }

    public class ProcessTime
    {

        public void GenerateTime(string s)   //event handle
        {

            Console.WriteLine("Hello {0}!The time is {1} now", s, DateTime.Now);

        }

    }
}