In c# is there a way to avoid computing expensive parameters.
Example
DebugLog(object.getName());
If I want to avoid the call to getName(say its expensive) I have to do
#if DEBUG
DebugLog(object.getName());
#endif
In other languages I can make a log macro that is a no-op if the log level is a certain way and just do
DebugLog(anything i want as it just is skipped)
Is there some way other then to have ugly defines around every single log?