Night Walker
Night Walker

Reputation: 21260

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.

Upvotes: 3

Views: 334

Answers (2)

Tim Lloyd
Tim Lloyd

Reputation: 38434

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?

Upvotes: 11

ChaosPandion
ChaosPandion

Reputation: 78252

bool is64bit = IntPtr.Size == 8;

Upvotes: 4

Related Questions