c# 有什么预定义的#if 符号?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21461/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-01 09:08:01  来源:igfitidea点击:

What Predefined #if symbos does c# have?

提问by BCS

#if SYMBOL
  //code
#endif

what values does C# predefine for use?

C# 预定义了哪些值以供使用?

采纳答案by Frank Krueger

To add to what Nick said, the MSDN documentation does not list any pre-defined names. It would seem that all need to come from #defineand /define.

补充一下 Nick 所说的,MSDN 文档没有列出任何预定义的名称。似乎所有的都需要来自#define/define

#if on MSDN

#if 在 MSDN 上

回答by Nick

Depends on what /define compiler options you use. Visual Studioputs the DEBUGsymbol in there for you via the project settings, but you could create any ones that you want.

取决于您使用的 /define 编译器选项。 通过项目设置为您Visual Studio放置DEBUG符号,但您可以创建任何您想要的符号。

回答by dguaraglia

Well, that depends on the compiler you are using, and the command line options. Mono defines different names than Microsoft's compiler by default, and depending on what system you are you get different defines, etc.

嗯,这取决于您使用的编译器和命令行选项。默认情况下,Mono 定义的名称与 Microsoft 的编译器不同,并且根据您使用的系统,您会获得不同的定义等。

If you provide a more specific system for which you are compiling, we might be able to come up with the list for that particular system (for example: x64 Vista system, using Visual Studio 2008).

如果您提供要编译的更具体的系统,我们或许能够为该特定系统提供列表(例如:x64 Vista 系统,使用 Visual Studio 2008)。