Any way to use method parameter when DEBUG=true, like ConditionalAttribute but for parameter:
static void Recursion(int depth)
{
//.. some code here
// .. Recursion(depth); ..
}
For my case I need something like:
Recursion([ConditionalParameter("DEBUG")] int depth)
CodePudding user response:
You could do:
static void Recursion(
#if DEBUG
int depth
#endif
)
{
//.. some code here
// .. Recursion(depth); ..
}
But I wouldn't recommend it.
CodePudding user response:
I think you should use Debugger.IsAttached
in combination with an if
statement:
public void Recursion(int depth) {
if (Debugger.IsAttached) {
//do something with depth
}else {
//do something without depth
}
}