Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get system type by c# code?

Tags:

c#

How can I get system type by c# code? for example: 32 bit. (win 7 Ent)

like image 814
sari Avatar asked Aug 25 '26 07:08

sari


2 Answers

Environment.Is64BitOperatingSystem
Environment.Is64BitProcess
Enviromment.OSVersion

And for OSVersion look in this for constructing OS name - OS version realations: Determine OS using Environment.OSVersion

and this contains the different OS name, OS version relations:

http://www.nirmaltv.com/2009/08/17/windows-os-version-numbers/

Lastly, if you don't want to do all that code yourself, you could use this code (which will get you edition etc. but is not based on Environment):

http://www.csharp411.com/determine-windows-version-and-edition-with-c/

like image 138
Lasse Espeholt Avatar answered Aug 27 '26 21:08

Lasse Espeholt


Checkout the IntPtr.Size property:

The value of this property is 4 on a 32-bit platform, and 8 on a 64-bit platform.

like image 32
Darin Dimitrov Avatar answered Aug 27 '26 22:08

Darin Dimitrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!