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");
            }

 

相关文章:

  • 2021-08-31
  • 2022-01-07
  • 2022-01-17
  • 2021-09-04
  • 2022-01-10
  • 2021-05-30
  • 2021-07-03
猜你喜欢
  • 2021-07-12
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2021-08-12
相关资源
相似解决方案