奇妙的EventHandler

sing System;
using System.Linq;
using System.Runtime.InteropServices;
namespace ConTest
{
    class Program      {
      
        public EventHandler ContentViewActive = delegate { };
        static void Main(string[] args)
        {

            Program p = new Program();
            p.ContentViewActive += delegate
            {
                Console.WriteLine("Welcome");
                Console.WriteLine("To");
                Console.WriteLine("You!");

            };
            p.ContentViewActive(new object(), new EventArgs());
            /*输出结果
             *Welcome
             *To
             *You             *
             * */
            Console.Read();
        }
   
      
      
    }
}

posted @ 2013-04-26 19:44  Predator  阅读(85)  评论(0编辑  收藏  举报