❤️ 关注 Furion 微信公众号有惊喜哦!
Skip to main content

3. DataValidator 静态类

3.1 验证对象数据

var result = DataValidator.TryValidateObject(obj);

3.2 验证单个值

var result = DataValidator.TryValidateValue(value, typeof(RequiredAttribure), typeof(RangeAttribute));

3.3 正则表达式验证单个值

var result = DataValidator.TryValidateValue(value,"正则表达式");

3.4 验证类型验证单个值

var result = DataValidator.TryValidateValue(value, ValidationTypes.Number);

var result2 = DataValidator.TryValidateValue(value, ValidationPattern.AllOfThem, ValidationTypes.Number, ValidationTypes.Required);