[Conditional("DEBUG")),如何“假"有条件? [英] [Conditional("DEBUG")], How to 'false' Conditional ?
问题描述
您好专家
作为一个问题,有人知道如何实现条件[[DEBUG]]的错误条件
可能是这样的
有条件的["NOTDEBUG"]
我知道有可能
Hello Experts
As question suggest anybody have idea how to implement false conditional of Conditional["DEBUG"]
may be something like this
Conditional["NOTDEBUG"]
I know it is possible with
#if !DEBUG
...code here
#endif
但我需要有条件的
在此先感谢
but I need it with Conditional
Thank in Advance
推荐答案
但我需要带条件
这绝对是零意义.这是没有问题的.使用#if检查DEBUG的值与定义DEBUG的级别相同.换句话说,唯一的方法就是添加一个返回布尔值的方法,并使用#if DEBUG使其正确返回true或false.那只是包装支票,不会改变您需要做的支票的性质.
This makes absolutely zero sense. It is a non question. Checking the value of DEBUG with #if works on the same level that DEBUG is defined. In other words, the only way to do this is to add a method that returns a bool and use #if DEBUG to have it return true or false correctly. That is just wrapping the check, it does not change the nature of the check you need to make.
这篇关于[Conditional("DEBUG")),如何“假"有条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!