using System.Diagnostics.Contracts;
public int DivideNumbers(int numerator, int denominator)
{
Contract.Requires(denominator != 0);
return numerator / denominator;
}
using System.Diagnostics.Contracts;
public int DivideNumbers(int numerator, int denominator)
{
Contract.Requires<ArgumentOutOfRangeException>(denominator != 0);
return numerator / denominator;
}
using System.Diagnostics.Contracts;
public int IncrementByRandomAmount(int input)
{
Contract.Requires<ArgumentNullException>(input != null); // Don't allow null parameter.
Contract.Requires<ArgumentOutOfRangeException>(input < int.MaxValue); // We can't do anything if...