什么是C##如果DEBUG预处理器指令的使用情况如何?我们什么时候必须使用这个? [英] What is the usage of #if DEBUG pre-processor directive in C#? When must we use this?

查看:140
本文介绍了什么是C##如果DEBUG预处理器指令的使用情况如何?我们什么时候必须使用这个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是的#如果DEBUG 在C#预处理器指令的使用情况如何?我们什么时候必须使用这个

What is the usage of #if DEBUG pre-processor directive in C#? When must we use this?

推荐答案

在调试模式:

#if DEBUG
            System.Console.WriteLine("Debug version");
#endif
            System.Console.WriteLine("Output");

输出为

Debug version
Output

在发行方式:

#if DEBUG
            System.Console.WriteLine("Debug version");
#endif
            System.Console.WriteLine("Output");

输出为

   Output

阅读:的#如果(C#参考)

用法:如果你有一组值是在调试模式下测试,而不是在你可以使用#如果DEBUG

Usage: If you have a set of values to be tested in the debug mode and not in the release mode you can use #if DEBUG

这篇关于什么是C##如果DEBUG预处理器指令的使用情况如何?我们什么时候必须使用这个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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