Exemple #1
0
        private static void IsDynamicBoxing()
        {
            var s1 = new MyType();
            s1.X = 5;

            dynamic s2 = s1;
            s2.Increment();

   
            Console.WriteLine(s1.X);
        }
Exemple #2
0
        private static void BoxingWithInterface()
        {
            var s1 = new MyType();
            s1.X = 5;

            IMyType s2 = s1;
            IMyType s3 = s2;
            s2.Increment();

            Console.WriteLine(s1.X);
            
        }