Esempio n. 1
0
        public static void Delegate()
        {
            MyStruct myStruct = new MyStruct(10);

            myStruct.Increment();
            MyDelegate increment = new MyDelegate(myStruct.Increment);

            increment();
            myStruct.Increment();
        }
Esempio n. 2
0
        public static void AnonymousDelegate()
        {
            MyStruct myStruct = new MyStruct(20);

            myStruct.Increment();
            Action increment = new Action(delegate { myStruct.Increment(); });

            increment();
            myStruct.Increment();
        }
Esempio n. 3
0
        public static void Action()
        {
            MyStruct myStruct = new MyStruct(30);

            myStruct.Increment();
            Action increment = myStruct.Increment;

            increment();
            myStruct.Increment();
        }