Hi There,
I'm currently in a mild state of confusion about the Conditional
Attribute. The code below is taken from the implementation of "Design
By Contract" that I've put in somewhere in my project. As you might
expect the code outputs "DBC_CHECK_ALL is defined" when
Check.Require(...) is called and the project is compiled with DEBUG
settings.
#define DBC_CHECK_ALL
public public sealed class Check
{
[Conditional("DEBUG")]
public static void Require(bool assertion, string message)
{
#if DBC_CHECK_ALL
Console.WriteLine("DBC_CHECK_ALL is defined");
#endif
//...<some code that needs to be executed>...
}
//...<some other functions>...
}
Now if I replace the [Conditional("DEBUG")] with
[Conditional("DBC_CHECK_ALL")] the whole method isn't executed
anymore. Can anyone explain to me why this is happening or what on
earth I'm missing here?
I suspect its something blatantly obvious but I can't find it for the
life of me.
Greetings
Frank