C# type

            Type t = typeof(string);
            if (t.IsPrimitive)//not 
            {
                Console.WriteLine("string is a Primitive");
            }
            else 
            {
                Console.WriteLine("string is not a Primitive");
            }

            Type t2 = typeof(String);
            if (t2.IsPrimitive)//not 
            {
                Console.WriteLine("String is a Primitive");
            }
            else
            {
                Console.WriteLine("String is not a Primitive");
            }

            Type t3 = typeof(int);
            if (t3.IsPrimitive)//yes 
            {
                Console.WriteLine("int is a Primitive");
            }
            else
            {
                Console.WriteLine("int is not a Primitive");
            }


            Type t4 = typeof(Int64);
            if (t4.IsPrimitive)//yes
            {
                Console.WriteLine("Int64 is a Primitive");
            }
            else
            {
                Console.WriteLine("Int64 is not a Primitive");
            }
原文地址:https://www.cnblogs.com/viviancc/p/3821695.html