指示 32 位或 64 位构建的 C# 指令 [英] C# Directive to indicate 32-bit or 64-bit build

查看:19
本文介绍了指示 32 位或 64 位构建的 C# 指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用开发机器(32 位或 64 位)时是否有某种 C# 指令可以使用,说明以下内容:

<前>如果(32 位 Vista)//设置一个属性为true否则如果(64位Vista)//设置一个属性为false

但我想在 Visual Studio 中执行此操作,因为我正在开发一个应用程序,需要在 32/64 位版本的 Vista 中进行测试.

这样的事情有可能吗?

解决方案

你能在运行时做吗?

if (IntPtr.Size == 4)//32 位否则如果(IntPtr.Size == 8)//64 位

Is there some sort of C# directive to use when using a development machine (32-bit or 64-bit) that says something to the effect of:

if (32-bit Vista)
    // set a property to true
else if (64-bit Vista)
    // set a property to false

but I want to do this in Visual Studio as I have an application I'm working on that needs to be tested in 32/64 bit versions of Vista.

Is something like this possible?

解决方案

Can you do it at runtime?

if (IntPtr.Size == 4)
  // 32 bit
else if (IntPtr.Size == 8)
  // 64 bit

这篇关于指示 32 位或 64 位构建的 C# 指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆