Search code examples
c#.netassert

What does System.Diagnostics.Debug.Assert(true) do?


I found the following code in a console application, which seemed a bit strange:

System.Diagnostics.Debug.Assert(true);

What does it do?


Solution

  • As mentioned by Gabe it doesnt do much:

    In a DEBUG build, the method call will do nothing. In a release build the method call will not even be compiled into the program.

    Probably the code was left there by mistake.