Tag Archives: 64 bits process

Finding out whether the process is 64 bits

Although .NET is great in hiding whether a process is 32 or 64 bits sometimes you still need to know this. Most likely when using interop. You cannot interop a 64 bit .NET and a 32 bit dll and vice versa!

Fortunately the IntPtr.Size property can be used for this.

if ( IntPtr.Size == 8 )
{
   // Pointer is 8 bytes -> 64 bit
}
if ( IntPtr.Size == 4 )
{
   // Pointer is 4 bytes -> 32 bit
}
Lastest update in May 2011, inital post in May 2011