public void RemoveNumber(int number, string reason) { if (!Number.HasValue && PossibleNumbers.Any(f => f == number)) { PossibleNumbers.Remove(number); if (PossibleNumbers.Count == 1) { SetValue(PossibleNumbers.Single(), "Only other Number left after remmove: " + reason); } else if (PossibleNumbers.Count == 2) { RaisePairLeft(false, reason); } } }
public void SetValue(int value, string reason, bool isInit = false) { if (PossibleNumbers.Contains(value)) { Number = value; PossibleNumbers.Clear(); PossibleNumbers.Add(value); if (!isInit) { RaiseFindMatch(false, reason); } } else { throw new Exception("Invalid Value"); } }