Example #1
0
        static void Main(string[] args)
        {
            Example ev = new Example();

            ev.triggerEvent();


            //multicast delegates example
            multicast del  = new multicast(employee1);
            multicast del1 = new multicast(employee3);

            del1();
            //multicast using single delegate for mutiple functions
            del += employee2;
            del();
            List <Employee> empList = new List <Employee>();

            Employee x = new Employee()
            {
                ID = 100, name = "tharun", Leaves = 20, Experience = 5
            };
            Employee y = new Employee()
            {
                ID = 101, name = "harry potter", Leaves = 5, Experience = 6
            };

            empList.Add(x);
            empList.Add(y);
            IsEligible EligibleForVacation = new IsEligible(Allot);

            Employee.Vacation(empList, Allot);
        }
Example #2
0
        static void Main(string[] args)
        {
            Program p = new Program();

            del d = new del(p.show);

            d();

            del dd = new del(showme);

            dd();

            List <Employee> ll = new List <Employee>()
            {
                new Employee()
                {
                    id = 1, name = "kjkjb", sal = 254
                },
                new Employee()
                {
                    id = 2, name = "aaaaa", sal = 256444
                },
                new Employee()
                {
                    id = 7, name = "bbbbb", sal = 2544
                }
            };


            verificaton v = new verificaton(p.doverify);

            Employee e = new Employee();

            e.verify(ll, v);

            multicast m = new multicast(aaa);

            m += bbb;

            string ss = m(" SI ");

            Console.WriteLine(ss);


            // anonymous

            dd ddd = (string a) =>
            {
                return(a);
            };

            string zz = ddd("ajshvassjhjhkvj");

            Console.WriteLine(zz);
        }