Postconditions C# with Example
public double GetPaymentsTotal(string name) { Contract.Ensures(Contract.Result() >= 0); double total = 0.0; foreach (var payment in this._payments) { if (string.Equals(payment.Name, name)) { total += payment.Amount; } } return total; }