using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Threading;namespace ConsoleApplication1
{
    class Program
    {
        public delegate void Messageprintdelegate(string msg);
        private delegate int GetcountDelegate(person obj1, person obj2);
        protected delegate void Lonrunningdelegate(Messageprintdelegate mpcallback);
        static void Longrunningmethod(Messageprintdelegate mpd)
        {
            for (int i = 0; i < 99; i++)
            {
                if (i % 10 == 0)
                {
                    mpd(string.Format("Making progress.{0}% complete.", i));
                }
            }
        }        static int Getcount(object obj1, object obj2)
        {
            Random rnd = new Random();
            return rnd.Next();
        }        static void printmessage(string msg)
        {
            Console.WriteLine("{0}  {1}",DateTime.Now.ToShortTimeString(),msg);   
        }
        static void Main(string[] args)
        {
            Messageprintdelegate mpdel = new Messageprintdelegate(printmessage);
            GetcountDelegate gcd = new GetcountDelegate(Getcount);
            int count = gcd(new person(), new person());
            Console.WriteLine("Count received {0}",count);
            Lonrunningdelegate lrd = new Lonrunningdelegate(Longrunningmethod);
            lrd(mpdel);
            Console.ReadLine();                               
        }   
    }
    class person
    { 
    }    class contact : person
    { 
        
    }
}