Пример #1
0
 public static ArgumentException CreateForParamValidation(Param param, string message)
 {
     return new ArgumentException(
         param.ExtraMessageFn == null 
             ? message 
             : string.Concat(message, Environment.NewLine, param.ExtraMessageFn()),
         param.Name);
 }
Пример #2
0
        public static InvalidOperationException CreateForInvalidOperation(Param param, string message)
        {
            var msg = string.Format(message, param.Name);

            return new InvalidOperationException(
                param.ExtraMessageFn == null
                    ? msg
                    : string.Concat(msg, Environment.NewLine, param.ExtraMessageFn()));
        }
 public static void Matches(this Param <string> param, [RegexPattern] string match) => Matches(param, new Regex(match));