System.Diagnostics.Debug.Assert
Checks for a condition and displays a message if the condition is false.
Assert(Boolean) Checks for a condition and outputs the call stack if the condition is false.
Refer: http://msdn.microsoft.com/en-us/library/system.diagnostics.debug.assert.aspx
One advantage of Debug.Assert() is that the C# and VB compilers (not C++) eliminate the Debug.Assert() statement from the CIL code when the DEBUG precompile constant is not defined.
Refer: http://mark.michaelis.net/Blog/DontUseTheSystemDiagnosticsAssertMethodsUnless.aspx
Dont use it in production / release code.
Leave a comment