best practice

System.Diagnostics.Debug.Assert

Posted on March 28, 2009. Filed under: .NET, best practice, C#, programming | Tags: , , |

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.

Advertisements
Read Full Post | Make a Comment ( None so far )

    About

    My stuff about .NET, C#, ASP.NET, AJAX, Visual Studio, SQL Server, XML, Web Services, WCF, WPF, WF, CRM, etc.

    RSS

    Subscribe Via RSS

    • Subscribe with Bloglines
    • Add your feed to Newsburst from CNET News.com
    • Subscribe in Google Reader
    • Add to My Yahoo!
    • Subscribe in NewsGator Online
    • The latest comments to all posts in RSS

    Meta

Liked it here?
Why not try sites on the blogroll...