Having recently learned about the DebuggerDisplay attribute , I found it very useful. However, one thing surprises me: it does not have an attribute [ConditionalAttribute("DEBUG")]attached to it. Is there a way to make this or is it a bad idea to try? Or is it not important for some other reason?
[ConditionalAttribute("DEBUG")]
[ConditionalAttribute ("DEBUG")] is used only to optimize method calls.
If you really want to remove them from your collections, you can use #ifdef so that the code compiles only in release mode.
, , pdb, .
Release, DEBUG, , .
DEBUG
, - , , , ConditionalAttribute #if/#elif/#endif , .
ConditionalAttribute
#if/#elif/#endif
, :
#if DEBUG [DebuggerDisplay...] #endif public class MyAwesomeClass { }
, DEBUG.
, , partial.
partial
public partial class MyClass{ //class details here }
:
#if DEBUG [DebuggerDisplay("DebuggerValue")] public partial class MyClass{ //anything needed for debugging purporses } #endif
DebuggerDisplay .
, #if DEBUG, Debug-Partials. , / .
#if DEBUG
, , , , - , , , IMO.
Source: https://habr.com/ru/post/1712133/More articles:Cross-platform encryption container library - cHow to βrefreshβ a window in IE without stealing window focus? - javascriptC ++ Encapsulation Methods - c ++C # /. NET Custom Code Analysis - c #Does extreme programming have a negative effect on your ability to win new customers? - extreme-programmingOracle CASE with OR - oracleJQuery real-time validation - javascriptHow to turn a very long column into a few shorter ones? - javascriptcross-platform storage framework + metadata? - databaseReading time indicated on the Firebug Net tab - performanceAll Articles