'Assert' statements in .NET production code
问题 Is it wise to leave Trace.Assert and Debug.Assert statements in code that is "stable" and which has been moved into Test and Production environments? If so, how do these assertion statements help? Isn't it sufficient to have Guard classes, etc. check for exception conditions and raise exceptions as appropriate? 回答1: Debug.Assert statements will be ignored unless you have the DEBUG compilation constant defined, which by default happens when you compile in the "debug" configuration and not in