Postconditions
suggest changePostconditions ensure that the value returned from a method matches the contract. That gives the caller a definition of the expected result. Postconditions can allow a simpler implementation, because the static analyzer rejects some outcomes that the contract forbids.
Example…
string GetValue()
{
Contract.Ensures(Contract.Result<string>() != null);
return null;
}
Static analysis result…
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents