Example #1
0
        public object Clone()
        {
            Counter1 result = new Counter1
            {
                Value = this.Value
            };

            return(result);
        }
Example #2
0
        public static void Main(string[] args)
        {
            int  a  = 5;
            int  b  = 2;
            Swap sp = Swap1;

            sp += Swap2;

            sp?.Invoke(ref a, ref b);
            Foo(a, b);

            Counter c1 = new Counter();

            c1[0] = 5;
            c1[1] = 10;
            Console.WriteLine("c1[0] = {0}, , c1[1] = {1}, c1[2] = {2}", c1[0], c1[1], c1[2]);


            Counter1 c = new Counter1();

            c.ValueChanged += CounterValueChanged;

            new Thread(() =>
            {
                c.Value = 5;
            })
            .Start();

            new Thread(() =>
            {
                c.Value = 10;
            })
            .Start();

            c.Value = -10;

            Counter1 z = (Counter1)c.Clone();

            z.ValueChanged += CounterValueChanged;
            z.Value         = 100;

            Console.ReadKey();
        }