Пример #1
0
        /// <summary>
        /// 创建字符串长度设置
        /// </summary>
        /// <param name="min">至少</param>
        /// <returns></returns>
        public static Validator StringLength(int min)
        {
            if (min < 1)
            {
                throw new ArgumentOutOfRangeException("min");
            }
            var result = new FormValidate.StringLength
            {
                Min = min
            };

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 创建字符串长度设置
        /// </summary>
        /// <param name="min">至少</param>
        /// <param name="max">至多</param>
        /// <returns></returns>
        public static Validator StringLength(int min, int max)
        {
            if (max < 1)
            {
                throw new ArgumentOutOfRangeException("max");
            }
            var result = new FormValidate.StringLength();

            if (min > 0)
            {
                result.Min = min;
            }
            result.Max = max;
            return(result);
        }