, 2 , :
- check/entry point return value/exit point assertion.
, .
: throw ArgumentException.
ArgumentException - , , , .
There is much more going on with Code Contracts, but I just dipped my sock and I don’t have a version that does super-comprehensive static checks. I plan to work more on using Code Contracts, and as soon as I do, it will be more elegant to check the parameters using the same structure instead of switching between code contracts and if / then / throw ArgumentException
source
share