C#编译成x86与x64区别

        static void Main(string[] args)
        {

            Console.WriteLine("This applications is compiled to run on all processors.");

            Console.WriteLine("Checking IntPtr.Size to see if this application is running as a 32bit or 64bit application.");
            
            Console.WriteLine("IntPtr.Size = " + IntPtr.Size);

            if (IntPtr.Size == 4)
                Console.WriteLine("This application is running as a 32bit Process.");
        
            if (IntPtr.Size == 8)
                Console.WriteLine("This application is running as a 64bit Process!!!");
            Console.Read();
        }

 

编译器选项: Csc.exe  /platform:x86     或    在属性页中目标平台选择x86.

IntPtr 大小不同,一个为4,一个为8

 

 

 

版权声明:本文为hbhbice原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/hbhbice/archive/2013/05/10/3071578.html