TimeSpanRangeAttribute

Ecng.ComponentModel

Validates that a TimeSpan value is within the specified range (inclusive).

継承元: RangeAttribute

実装: IValidator

コンストラクター

TimeSpanRangeAttribute
public TimeSpanRangeAttribute(TimeSpan minimum, TimeSpan maximum)
timeSpanRangeAttribute = TimeSpanRangeAttribute(minimum, maximum)

Creates a new instance of TimeSpanRangeAttribute.

minimum
Minimum value (inclusive).
maximum
Maximum value (inclusive).
TimeSpanRangeAttribute
public TimeSpanRangeAttribute(string minimum, string maximum)
timeSpanRangeAttribute = TimeSpanRangeAttribute(minimum, maximum)

Creates a new instance of TimeSpanRangeAttribute using string constants suitable for attribute usage.

minimum
Minimum value (inclusive), e.g. "00:00:00".
maximum
Maximum value (inclusive), e.g. "00:00:02".

プロパティ

DisableNullCheck
public bool DisableNullCheck { get; set; }
value = timeSpanRangeAttribute.DisableNullCheck
timeSpanRangeAttribute.DisableNullCheck = value

Gets or sets a value indicating whether null checks should be disabled.

MaximumTs
public TimeSpan MaximumTs { get; }
value = timeSpanRangeAttribute.MaximumTs

Maximum value (inclusive).

MinimumTs
public TimeSpan MinimumTs { get; }
value = timeSpanRangeAttribute.MinimumTs

Minimum value (inclusive).

メソッド

IsValid
public override bool IsValid(object value)
result = timeSpanRangeAttribute.IsValid(value)

Validates the specified value by converting it and applying the custom validation.

value
The value to validate.

戻り値: True if the value is valid; otherwise, false.