예제 #1
0
        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;
        }
예제 #2
0
 /// <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));
 }