hbhbice

导航

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

 

 

 

posted on 2013-05-10 17:24  hbhbice  阅读(826)  评论(0编辑  收藏  举报