更新时间:2023-12-06 09:45:04
史蒂夫的例子是有点过时了(虽然还是不错的)。他已经可以通过现在System.ComponentModel.DataAnnotations.Validator类被替换的DataAnnotationsValidationRunner,它为验证已经装饰有DataAnnotations属性和对象的静态方法属性。
Steve's example is a bit dated (though still good). The DataAnnotationsValidationRunner that he has can be replaced by the System.ComponentModel.DataAnnotations.Validator class now, it has static methods for validating properties and objects which have been decorated with DataAnnotations attributes.