예제 #1
0
        public static void Main()
        {
            Client3 c1_o1 = new Client3("Object1 of Client3 class");
            Client3 c1_o2 = new Client3("Object2 of Client3 class");
            Client3 c1_o3 = new Client3("Object3 of Client3 class");

            Evt += new LinkToEventHandler3(c1_o1.Client1EventHandler);
            Evt += new LinkToEventHandler3(c1_o2.Client1EventHandler);
            Evt += new LinkToEventHandler3(c1_o3.Client1EventHandler);
            DoSomething();
            Console.Read();
        }
예제 #2
0
            public static void Main(string[] args)
            {
                int n;

                Console.WriteLine("Enter  student number ");
                n = Convert.ToInt32(Console.ReadLine());
                Student_details[] sd = new Student_details[n];
                for (int i = 0; i < sd.Length; i++)
                {
lable1:
                    Console.WriteLine("Enter male or female m/f");
                    char ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('m') || ch.Equals('M'))
                    {
                        sd[i] = new MaleStudent1();
                        sd[i].Read();
                    }
                    else if (ch.Equals('f') || ch.Equals('F'))
                    {
                        sd[i] = new FeMaleStudent1();
                        sd[i].Read();
                    }
                    else
                    {
                        Console.WriteLine("Wrong input enter m of f");
                        goto lable1;
                    }
                }

                foreach (Student_details s in sd)
                {
                    if (s.GetMarks() >= 90)
                    {
                        AdmissionGrantedEvt += new LinkToEventHandler3(s.MyActionItem);
                    }
                    else
                    {
                        AdmissionDeniedEvt += new LinkToEventHandler3(s.MyActionItem);
                    }
                }
                SendEvent();
                Console.ReadLine();
            }