依頼と事件の整理


  public class UploadEnventcs

    {

        public event EventHandler CreateEvent;

        public delegate void CreateDele(object sender);

        public CreateDele cd;



        public void Upload()

        {

            if (CreateEvent != null)

            {

                Console.WriteLine("CreateEvent ");

                CreateEvent(this, null);

            }

            if (cd != null)

            {

                Console.WriteLine("CreateDele ");

                cd(this);

            }

        }

    }

よびだし
   class Program

    {

        static void Main(string[] args)

        {

            UploadEnventcs ue = new UploadEnventcs();

            ue.CreateEvent += ue_CreateEvent;

            ue.cd = new UploadEnventcs.CreateDele(CreateDelegate);



            ue.Upload();

        }



        static void ue_CreateEvent(object sender, EventArgs e)

        {

            Console.WriteLine(" ue_CreateEvent");

        }

        public static void CreateDelegate(object sender)

        {

            Console.WriteLine(" CreateDele ");

        }

    }