Esempio n. 1
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);
        }
Esempio n. 2
0
 public void verify(List <Employee> l, verificaton v)
 {
     foreach (Employee e in l)
     {
         if (v(e))                          // here v is a delegate and we see that if we
         {                                  // want to change out verification logic the we can do
                                            // do so by changing the logic of the method to which our delegate is pointing, thus alouing us not perform any change in the employee class
             Console.WriteLine(e.name);
         }
     }
 }