Beispiel #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 MaxLengthAttribute(length) { ErrorMessage = errorMessage }.ToValidBox();
     return ValidBox.Merge(box, newBox);
 }
Beispiel #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 MaxLengthAttribute(length).ToValidBox();
     return ValidBox.Merge(box, newBox);
 }