468,553 Members | 1,304 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,553 developers. It's quick & easy.

How do I detect if my .net application is running in 64 bit mode

Is there a function which returns is my application is in 64 bit mode?

-Martijn
Aug 21 '06 #1
4 4679
I would imagine that you could just take the size of a reference (if 4 bytes
= 32 if 8 bytes = 64) although there might be a method somewhere that
already does this.

Cheers,

Greg

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
Is there a function which returns is my application is in 64 bit mode?

-Martijn


Aug 21 '06 #2
You can just check the static Size property on the IntPtr class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Young" <dr*******************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I would imagine that you could just take the size of a reference (if 4
bytes = 32 if 8 bytes = 64) although there might be a method somewhere that
already does this.

Cheers,

Greg

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
>Is there a function which returns is my application is in 64 bit mode?

-Martijn



Aug 21 '06 #3
That's smart. Thanks for the answer.

Greetings,
Martijn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP04.phx.gbl...
You can just check the static Size property on the IntPtr class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Young" <dr*******************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>I would imagine that you could just take the size of a reference (if 4
bytes = 32 if 8 bytes = 64) although there might be a method somewhere
that already does this.

Cheers,

Greg

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
>>Is there a function which returns is my application is in 64 bit mode?

-Martijn




Aug 21 '06 #4
btw this code works fine:

public static bool Is64BitMode()
{
return System.Runtime.InteropServices.Marshal.SizeOf(type of(IntPtr))
== 8;
}

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:ev**************@TK2MSFTNGP02.phx.gbl...
That's smart. Thanks for the answer.

Greetings,
Martijn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2****************@TK2MSFTNGP04.phx.gbl...
> You can just check the static Size property on the IntPtr class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Young" <dr*******************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>>I would imagine that you could just take the size of a reference (if 4
bytes = 32 if 8 bytes = 64) although there might be a method somewhere
that already does this.

Cheers,

Greg

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
Is there a function which returns is my application is in 64 bit mode?

-Martijn




Aug 21 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Daniel Loose | last post: by
1 post views Thread by Scott Shaw | last post: by
6 posts views Thread by Stephane Belzile | last post: by
9 posts views Thread by Wayne Wengert | last post: by
reply views Thread by MIke Kansky | last post: by
15 posts views Thread by Eric Renken | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.