public void Add(string ruleName, Func <ValidationEvent, bool> rule) { ValidationRuleDef item = new ValidationRuleDef { Name = ruleName, Rule = rule }; this._rules.Add(item); }
public void Remove(string name) { List <int> list = new List <int>(); for (int i = 0; i < this._rules.Count; i++) { ValidationRuleDef validationRuleDef = this._rules[i]; if (string.Compare(validationRuleDef.Name, name, true) == 0) { list.Add(i); } } if (list.Count > 0) { list.Reverse(); foreach (int current in list) { this._rules.RemoveAt(current); } } }