public class Test{
[Conditional("Debug")]
public void Method()
{
// ....
}
}
Today, I've found a bug in my code, associated with this.
[Conditional("DEBUG")]
I had written the string in capital letters. But in runtime or compile-time, there's not an error about it. It simply and silently "doesn't work."
It took an hour to realize this. It would be great if they used an enum, for examle:
[Conditional(ConditionalModes.Debug)]
or different attribute types for each mode:
[DebugConditional]
This is not a big thing of course, but these kind of design decisions are important.
I always prefer compile time errors -where possible- :)
No comments:
Post a Comment