64 or 32 bit
-
How can you determine at run time in C# if you're running on a 32 or 64 bit machine Jared Parsons jaredp@beanseed.org http://jaredparsons.blogspot.com/[^]
-
How can you determine at run time in C# if you're running on a 32 or 64 bit machine Jared Parsons jaredp@beanseed.org http://jaredparsons.blogspot.com/[^]
Hello Jared, I am not sure about this method. Becoz i have no PC of 64 bit. But you just try. Check size of 'int'. like
val = sizeof(int);
if it is 4 byte then 32 bit machine & if 8 byte then 64 bit machine. For my 32 bit machine it is 4. Regards, Divyang Mithaiwala -
How can you determine at run time in C# if you're running on a 32 or 64 bit machine Jared Parsons jaredp@beanseed.org http://jaredparsons.blogspot.com/[^]
Values are the same size for both 32 and 64-bit (an int is 4 bytes on both.) I don't believe there is a simple, standard way to detect this. Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
Values are the same size for both 32 and 64-bit (an int is 4 bytes on both.) I don't believe there is a simple, standard way to detect this. Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
Hello Joe, Sorry for my answer. But i think that int data type is for best CPU performance. And for fix length type you have to take long & short. Regards, Divyang Mithaiwala
-
How can you determine at run time in C# if you're running on a 32 or 64 bit machine Jared Parsons jaredp@beanseed.org http://jaredparsons.blogspot.com/[^]
sizeof(IntPtr) should give you the answer :)
-
Hello Joe, Sorry for my answer. But i think that int data type is for best CPU performance. And for fix length type you have to take long & short. Regards, Divyang Mithaiwala
-
How can you determine at run time in C# if you're running on a 32 or 64 bit machine Jared Parsons jaredp@beanseed.org http://jaredparsons.blogspot.com/[^]
You can use
val = IntPtr.size
But it will give bit of platform not a machine. Which is some time difference. For more information click here Regards, Divyang Mithaiwala -
The int data type is just an alias for System.Int32. A long is System.Int64 and short is System.Int16. MSDN: C# Built-in Types[^] --- b { font-weight: normal; }
Hello Guffa, Actually i am not wrong with my thing. But it will not work in C#. Please refer this. Regards, Divyang Mithaiwala.
-
How can you determine at run time in C# if you're running on a 32 or 64 bit machine Jared Parsons jaredp@beanseed.org http://jaredparsons.blogspot.com/[^]
Hi I presume you have a 32-bit assembly and want to know if you are running on a native 32-bit machine or under WOW64 on a native 64-bit machine. There is an API method
IsWow64Process
you can call using pinvoke - I could not find a managed method. ---------------------------- Be excellent to each other :) -
Hello Guffa, Actually i am not wrong with my thing. But it will not work in C#. Please refer this. Regards, Divyang Mithaiwala.
-
Hello Jared, I am not sure about this method. Becoz i have no PC of 64 bit. But you just try. Check size of 'int'. like
val = sizeof(int);
if it is 4 byte then 32 bit machine & if 8 byte then 64 bit machine. For my 32 bit machine it is 4. Regards, Divyang MithaiwalaDivyang Mithaiwala wrote:
if it is 4 byte then 32 bit machine & if 8 byte then 64 bit machine. For my 32 bit machine it is 4.
That doesn't work in C# because int is guaranteed to be 4 bytes regardless of the architecture. Jared Parsons jaredp@beanseed.org http://jaredparsons.blogspot.com/[^]
-
sizeof(IntPtr) should give you the answer :)
Or better yet IntPtr.Size. That looks like the right approach though. Thanks! Jared Parsons jaredp@beanseed.org http://jaredparsons.blogspot.com/[^]