How can I programmatically determine which platform this code is running on?

How can I find out from the code if I run under x86 or under x64.

Thanks for the help.

+3
source share
2 answers

You can use the following properties Environment:

System.Environment.Is64BitOperatingSystem

System.Environment.Is64BitProcess

Update

For platforms prior to .Net 4.0, the following functions can be used to implement the above functions:

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

+11
source
bool is64bit = IntPtr.Size == 8;
+4
source

Source: https://habr.com/ru/post/1787499/


All Articles