Design by contracts and constructors
- by devoured elysium
I am implementing my own ArrayList for school purposes, but to spice up things a bit I'm trying to use C# 4.0 Code Contracts. All was fine until I needed to add Contracts to the constructors. Should I add Contract.Ensures() in the empty parameter constructor?
public ArrayList(int capacity) {
Contract.Requires(capacity > 0);
…