3 ms·
The big advantage to code contracts is that they prevent null reference exceptions at compile time. Catching potential problems at compile time via static check
by viggity 17y ago
The big advantage to code contracts is that they prevent null reference exceptions at compile time. Catching potential problems at compile time via static checking is preferable than throwing an exception at runtime. Your code is more resilient to bad data.
Having a formal checking mechanisms like code contracts also helps tools like Pex generate better sets of test inputs for automated unit testing.