C# Directive to indicate 32-bit or 64-bit build

后端 未结 9 1477
你的背包
你的背包 2020-12-16 04:04

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         


        
9条回答
  •  南方客
    南方客 (楼主)
    2020-12-16 04:39

    What I use in my C# code is IntPtr.Size, it equals 4 on 32bit and 8 on 64bit:

    string framework = (IntPtr.Size == 8) ? "Framework64" : "Framework";
    

提交回复
热议问题