VS2013 - Specific action for a few configs

2019-09-11 02:26发布

问题:

Here is a question i asked earlier, that can explain what i am looking for:

The question with help you understand the problem is here

What will be better?

#if (!DEBUG || !DEBUG1 || !DEBUG2 || !DEBUG3) 
variable=5; #endif

or

if( !System.Diagnostics.Debugger.IsAttached )
{
  //code which should only run if not being debugged
}

If I want to attach this specific action to my 4 configs, should i use first option or the second will also be good, because System.Diagnostics.Debugger.IsAttached will fit to each of my configs?