示例#1
0
    public static void Main()
    {
        Delegacja del = Odejmowanie;

        Console.WriteLine(del(13.567, 12.89));
        Console.ReadKey();
    }
示例#2
0
        public static void Main(string[] args)
        {
            Kontener  kontener   = new Kontener();
            Delegacja delegacja1 = WyswietlW1;
            Delegacja delegacja2 = WyswietlW2;

            Delegacja delegacja3 = delegacja1 + delegacja2;

            kontener.WyswietlCallBack(delegacja3);

            Console.WriteLine("------------------------------------------------------------------------");
            delegacja3 -= delegacja2;
            kontener.WyswietlCallBack(delegacja3);

            Console.WriteLine("------------------------------------------------------------------------");
            delegacja3 += delegacja2;
            kontener.WyswietlCallBack(delegacja3);

            Console.WriteLine("------------------------------------------------------------------------");
            delegacja3 += delegacja2;
            kontener.WyswietlCallBack(delegacja3);
            Console.ReadKey();

            Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            Delegacja del = Metoda1;

            del("To jest napis przekazany do delegacji.");

            Console.ReadKey();
        }
示例#4
0
        static void Main(string[] args)
        {
            Pojemnik  pojemnik   = new Pojemnik();
            Delegacja delegacja1 = PoliczPole;

            pojemnik.ObliczPoleCallBack(delegacja1);
            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)
        {
            Delegacja delegacja = MetodaDelegowana;

            delegacja();

            Console.ReadKey();
        }
示例#6
0
        static void Main(string[] args)
        {
            Delegacja del     = Dodaj;
            int       wartosc = del(4, 8);

            Console.WriteLine("Wynikiem jest {0}.", wartosc);

            Console.ReadKey();
        }
示例#7
0
        static void Main(string[] args)
        {
            Delegacja del1 = Metoda1;

            //Delegacja del2 = Metoda2;
            del1();
            //del2();
            Console.ReadKey();
        }
示例#8
0
        static void Main(string[] args)
        {
            WartosciDouble ja   = new WartosciDouble(24);
            Delegacja      moja = new Delegacja(ja.kwadrat);

            moja += ja.Sinus;
            moja(10);
            Console.ReadKey();
        }
示例#9
0
        static void Main(string[] args)
        {
            Student   Jan          = new Student("Jan");
            Delegacja CoTamMistrzu = new Delegacja(Jan.PrzedstawSie);

            //CoTamMistrzu("Mi");
            CoTamMistrzu += DawajSuchara;
            CoTamMistrzu("dr Wiliński");
            CoTamMistrzu -= Jan.PrzedstawSie;
            CoTamMistrzu("dr Wiliński");
            CoTamMistrzu += Jan.PrzedstawSie;
            CoTamMistrzu("dr Wiliński");
            Console.ReadKey();
        }
示例#10
0
        static void Main(string[] args)
        {
            A a = new A();

            a.DoRoboty(5);
            Console.WriteLine("{0}", a.i);
            Delegacja raz = x => { Console.WriteLine("raz"); return(x + 1); };

            a.SieDzieje += new Delegacja(raz);
            a.DoRoboty(a.i);
            Console.WriteLine("{0}", a.i);
            a.SieDzieje += new Delegacja(delegate(int x)
                                         { Console.WriteLine("dwa {0}", x + a.i); return(2 + x); });
            a.DoRoboty(a.i);
            Console.WriteLine("{0}", a.i);
            a.SieDzieje += new Delegacja(raz);
            a.DoRoboty(a.i);
            Console.WriteLine("{0}", a.i);
        }
示例#11
0
        static void Main(string[] args)
        {
            A a = new A();

            a.DoRoboty(2);
            Console.WriteLine("{0}", a.x);
            Compare   w   = (x, y) => (x < y);
            Delegacja fst = (x, y) => (w(x, y) ? x + y : x - y);

            a.SieDzieje += fst;
            a.DoRoboty(3);
            Console.WriteLine("{0}", a.x);
            a.SieDzieje += (x, y) => {
                Console.WriteLine((w(x, y) ? "A {0}" : "B {0}"), ++a.x);
                return(1 + x);
            };
            a.DoRoboty(4);
            Console.WriteLine("{0}", a.x);
            a.SieDzieje -= fst;
            a.DoRoboty(a.x);
            Console.WriteLine("{0}", a.x);
            Console.ReadKey();
        }
示例#12
0
 public void ObliczPoleCallBack(Delegacja del)
 {
     del(this);
 }
 public void changeName(string fName, string sName, Delegacja call)
 {
     firstName = fName;
     lastName  = sName;
     zmiana("imie i nazwisko zostalo zmienione");
 }
示例#14
0
 public void WyswietlCallBack(Delegacja del)
 {
     del(this);
 }