简体   繁体   中英

How I can know programmatically what platform the code is running under?

How i can know from the code if i run under x86 OS or under x64 OS .

Thanks for help.

You can use the following Environment properties:

System.Environment.Is64BitOperatingSystem

System.Environment.Is64BitProcess

Update

For platforms previous to .Net 4.0, the following can be used to implement the above functionality:

How to detect Windows 64-bit platform with .NET?

bool is64bit = IntPtr.Size == 8;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM