更新时间:2023-10-15 08:37:40
我是通过创建自定义属性获得的:
I got it by creating a custom attribute:
public class BooleanRequiredAttribute : RequiredAttribute
{
public override bool IsValid(object value)
{
return value != null && (bool) value;
}
}