public void Update(RuleAction newAction) { Guard.NotNull(newAction, nameof(newAction)); if (newAction.GetType() != action.GetType()) { throw new ArgumentException("New action has another type.", nameof(newAction)); } action = newAction; }
public Rule Update(RuleAction newAction) { Guard.NotNull(newAction, nameof(newAction)); if (newAction.GetType() != action.GetType()) { throw new ArgumentException("New action has another type.", nameof(newAction)); } return(Clone(clone => { clone.action = newAction; })); }
public Rule Update(RuleAction newAction) { Guard.NotNull(newAction); if (newAction.GetType() != action.GetType()) { throw new ArgumentException("New action has another type.", nameof(newAction)); } if (action.DeepEquals(newAction)) { return(this); } return(Clone(clone => { clone.SetAction(newAction); })); }