1、根据IntPtr.Size来判断,所有.NET版本都支持。
if(IntPtr.Size == 4)
{
//32位
}
if(IntPtr.Size == 8)
{
//64位
}
2、如果是.NET 4.0或之后的版本。
if(Environment.Is64BitProcess)
{
//64位
}
else
{
//32位
}
1、根据IntPtr.Size来判断,所有.NET版本都支持。
if(IntPtr.Size == 4)
{
//32位
}
if(IntPtr.Size == 8)
{
//64位
}
2、如果是.NET 4.0或之后的版本。
if(Environment.Is64BitProcess)
{
//64位
}
else
{
//32位
}