static public int NoCaseForgottenNoDefault(ThreeValues t) { Contract.Ensures(Contract.Result <int>() > 0); switch (t) { case ThreeValues.One: return(1); case ThreeValues.Four: return(4); case ThreeValues.Three: return(3); } return(-1); // unreachable }
static public int NoCaseForgotten(ThreeValues t) { Contract.Ensures(Contract.Result <int>() > 0); switch (t) { case ThreeValues.One: return(1); case ThreeValues.Four: return(4); case ThreeValues.Three: return(3); default: Contract.Assert(false); // unreachable, but we report it as valid as it is "false" break; } return(-1); // unreachable }