コード例 #1
0
ファイル: Program.cs プロジェクト: joohy97/StudyCSharp21
        static void Main(string[] args)
        {
            CustomNotifier notifier = new CustomNotifier();

            notifier.SomethingHappened += new EventHandler(MyHandler); //이벤트를 내가 만든 로직이 있는 메서드랑 연결

            for (int i = 0; i < 100; i++)
            {
                notifier.DoSomething(i);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: KImHayun/StudyCSharp21
        static void Main(string[] args)
        {
            Console.WriteLine("이벤트사용!");
            CustomNotifier notifier = new CustomNotifier();

            notifier.SomethingHappened += new EventHandler(MyHandler); //이벤트를 내가 만든 로직이 있는 메서드랑 연결

            for (int i = 1; i <= 100; i++)
            {
                notifier.Dosomething(i);
            }
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("이벤트 사용!");
            CustomNotifier notifier = new CustomNotifier();

            notifier.SomethingHAppened += new EventHandler(MyHandler);//이벤트를 내가 만든 로직이랑 연결

            for (int i = 1; i < 100; i++)
            {
                notifier.DoSomething(i);//100 이하에서 3, 6, 9에 관련된 값들만 나타남
            }
        }