I've looked up the difference on the microsoft site but can't really see the difference. links to the website are below
Any additional explaination would be great
Using visual studio c#
Requires
is a precondition, meaning that the condition specified must be true prior to the method being invoked. Ensures
is a postcondition, meaning that the method guarantees that the condition specified will be true after the method call is complete.
Preconditions and/or postconditions may be violated while the method is executing: the tests are done upon entry to and exit from of the method, respectively. An invariate condition is a contract that says that the specified condition always holds true.
Read Bertrand Meyer's Object-Oriented Software Construction for more [much more] detail. This paper by Meyer is shorter [much shorter].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With