protected MatchingRuleItem(IEnumerable <string> keyWords, IEnumerable <string> val, MatchingRuleType matchingRuleType) { Value = val?.ToList() ?? throw new ArgumentNullException(nameof(keyWords)); KeyWords = keyWords?.Where(x => !string.IsNullOrEmpty(x)).ToList() ?? throw new ArgumentNullException(nameof(keyWords)); if (!KeyWords.Any()) { throw new ArgumentException($"{nameof(keyWords)} cannot be empty", nameof(keyWords)); } Type = matchingRuleType; }
/// <summary> /// Create new rule item /// </summary> /// <param name="keyWords">keywords</param> /// <param name="val">value that this rule holds</param> /// <param name="matchingRuleType">type of matching</param> /// <returns></returns> public static MatchingRuleItem Create(IEnumerable <string> keyWords, IEnumerable <string> val, MatchingRuleType matchingRuleType) { return(new MatchingRuleItem(keyWords, val, matchingRuleType)); }