范围验证 - 排除0

时间:2017-10-05 20:28:04

标签: c# validation

我是编程的新手,并尝试为model=rpart(Train$service_date_max_count~ injury_type_cd+specialty_type_cd +state+age+sex+pedestrian_yn+vehicle_driver_yn+vehicle_passenger_yn +marital_status+category+extesio, data=Train,method ="anova") split.fun <- function(x, labs, digits, varlen, faclen) { gsub(" = ", ":\n", labs) } fancyRpartPlot(model , palettes = 'Oranges' ,tweak =0.8, split.fun=split.fun) 设置范围验证器,以确保利率在0到100之间。
我还想检查0应该包含在利率中,因为它必须更高。这就是我到目前为止所做的:

InterestRate

1 个答案:

答案 0 :(得分:2)

那么为什么不将其更改为10.01或更改为允许的最低值而不是0

[Range(0.01, 100, ErrorMessage = "The interest rate should be between 0.01 to 100.00 ")]
public decimal InterestRate { get; set; }