Hello,
I'm trying to identify whether my C# .NET 2.0 application is running
on a Windows x64 or x86 version.
I'm trying to avoid checking the version numbers because this will
have to work on Vista too, which shares identical build numbers for
x64 and x86.
I'm currently using this:
if (IntPtr.Size == 8)
return "x64";
else
return "x86";
However, I have a question:
If it's x64, I'm going to access a native non-managed C++ library and
run specific code, and if it's x86, I'll be accessing another library.
If the user had installed .NET 32-bit edition on Windows XP x64, would
it return 8? or 4?
i.e. does the size of IntPtr depend on the Windows version's platform
or the .NET version?
More importantly, is there a more reliable (and explicit) method of
detecting x86 vs. x64?
Does IntPtr even exist in VB (for other apps on the same concept but
in VB).
Thanks!