Search code examples
c#code-contracts

Does including Contract.Assert have any effect on execution?


I have seen code which includes Contract.Assert like,

Contract.Assert(t != null);

Will using Contract.Assert have a negative impact on my production code?


Solution

  • According to the manual on page 11, they're only included in your assembly when the DEBUG symbol is defined (which, of course, includes Debug builds, but not Release builds (by default)).