FOLLOW US
4dots Software CODE BLOG

How to check if running in 32-bit or 64-bit

Sometimes it is necessary to check whether we are running in 32-bit or 64-bit mode.
To do this use the following :
	

        public static bool Modex64
        {
            get
            {                
				if (Marshal.SizeOf(typeof(IntPtr)) == 8)
				{
					return true;
				}
				else
				{                        
					return false;
				}                               
            }
        }

We check whether the integer pointer has a size of 8. If it does we are running in 64-bit mode, if not in 32-bit mode.
 

Please Donate!

Please Share!