Class ComparableNotNegativeAttribute<T>
- Namespace
- Ecng.ComponentModel
- Assembly
- Ecng.ComponentModel.dll
Indicates that a comparable value must not be negative when provided.
public abstract class ComparableNotNegativeAttribute<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
-
ComparableNotNegativeAttribute<T>
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ComparableNotNegativeAttribute()
protected ComparableNotNegativeAttribute()
Methods
Validate(T?, bool)
Validates that the value is not negative if it is provided.
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 not negative; otherwise, false.