Class ComparableGreaterThanZeroAttribute<T>
- Namespace
- Ecng.ComponentModel
- Assembly
- Ecng.ComponentModel.dll
Indicates that a comparable value must be greater than zero when provided.
public abstract class ComparableGreaterThanZeroAttribute<T> : ComparableValidationAttribute<T>, IValidator where T : struct, IComparable<T>
Type Parameters
T
The type of value to compare. Must be a struct implementing IComparable<T>.
- Inheritance
-
ComparableGreaterThanZeroAttribute<T>
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ComparableGreaterThanZeroAttribute()
protected ComparableGreaterThanZeroAttribute()
Methods
Validate(T?, bool)
Validates that the value is greater than zero if it is not null.
protected override bool Validate(T? value, bool disableNullCheck)
Parameters
value
T?The nullable value to validate.
disableNullCheck
boolA flag indicating whether null value should bypass validation.
Returns
- bool
True if the value is null and null checks are disabled, or if the non-null value is greater than zero; otherwise, false.