Esempio n. 1
0
 /// <summary>
 /// 验证输入的长度
 /// </summary>
 /// <param name="box">验证框</param>       
 /// <param name="minLength">最小长度</param>
 /// <param name="maxLength">最大长度</param>
 /// <param name="errorMessage">提示信息</param>
 /// <returns></returns>
 public static ValidBox Length(this ValidBox box, int minLength, int maxLength, string errorMessage)
 {
     var newBox = new LengthRule(minLength, maxLength) { ErrorMessage = errorMessage }.ToValidBox();
     return ValidBox.Merge(box, newBox);
 }
Esempio n. 2
0
 /// <summary>
 /// 验证输入的长度
 /// </summary>
 /// <param name="box">验证框</param>       
 /// <param name="minLength">最小长度</param>
 /// <param name="maxLength">最大长度</param>       
 /// <returns></returns>
 public static ValidBox Length(this ValidBox box, int minLength, int maxLength)
 {
     var newBox = new LengthRule(minLength, maxLength).ToValidBox();
     return ValidBox.Merge(box, newBox);
 }