I want to check which CPU architecture is the user running, is it i386 or X64 or AMD64. I want to do it in C#. I know i can try WMI or Registry. Is there any other way apart from these two? My project targets .NET 2.0!
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- slurm: use a control node also for computing
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
You could ask the user perhaps?
Just kidding of course... I think WMI is what you would use for that. But maybe there is some other way as well?
If you go for WMI then LinqToWmi could be of use. I tried it out once, and it seemed pretty straight forward =) -> http://www.codeplex.com/linq2wmi
I know that this question is from the past, but as of 2017, there is now a simple method to know the architecture of the current process, in .net standard :
The value returned is one of X86, X64, ARM, ARM64 and gives the architecture of the process it's running in.
OSArchitecture
returns the architecture of the installed operating system instead.Links to the docs (pretty useless though...):
RuntimeInformation.ProcessArchitecture: https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.runtimeinformation.processarchitecture?view=netstandard-1.4
Architecture enumeration: https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.architecture?view=netstandard-1.4