How to use #if to decide which platform is being compiled for in C#

前端 未结 3 1357
死守一世寂寞
死守一世寂寞 2021-02-08 15:28

In C++ there are predefined macros:

#if defined(_M_X64) || defined(__amd64__)
    // Building for 64bit target
    const unsigned long MaxGulpSize = 1048576 * 128         


        
3条回答
  •  遥遥无期
    2021-02-08 16:12

    You can also just define a symbol (e.g. _x64) in the project properties for the x64 platform. Open the properties dialogue of your project, select the x64 platform, on the Build page, just put "_x64" into the "Conditional compilation symbols" box.
    Make sure to do this for both debug and release configuration.

提交回复
热议问题