var,dynamic,object的区别

            var T1 = "111";
            //不让编译通过 ,编译时就要确定类型
            //   T1 = 1;
            Console.WriteLine(T1.GetType());

            dynamic T2 = "111";
            ///能编译通过,编译时不确定类型,运行过程中能变换类型
            Console.WriteLine(T1.GetType());

            T2 = 1;
            Console.WriteLine(T2.GetType());

            T2 = DateTime.Now;
            Console.WriteLine(T2.GetType());

            //所有的类型都继承于OBJECT
            object T3 = "111";
            Console.WriteLine(T3.GetType());

            T3 = 1;
            Console.WriteLine(T3.GetType());

 

上一篇:flex布局justify-content发现


下一篇:CSS 样式摘要