Пример #1
0
 /// <summary>
 /// 验证输入的最大长度
 /// </summary>
 /// <param name="box">验证框</param>       
 /// <param name="length">最大长度</param>
 /// <param name="errorMessage">提示信息</param>
 /// <returns></returns>
 public static ValidBox MaxLength(this ValidBox box, int length, string errorMessage)
 {
     var newBox = new MaxLengthRule(length) { ErrorMessage = errorMessage }.ToValidBox();
     return ValidBox.Merge(box, newBox);
 }
Пример #2
0
 /// <summary>
 /// 验证输入的最大长度
 /// </summary>
 /// <param name="box">验证框</param>       
 /// <param name="length">最大长度</param>     
 /// <returns></returns>
 public static ValidBox MaxLength(this ValidBox box, int length)
 {
     var newBox = new MaxLengthRule(length).ToValidBox();
     return ValidBox.Merge(box, newBox);
 }