編集

次の方法で共有


TimeSpanValidator Constructors

Definition

Initializes a new instance of the TimeSpanValidator class.

Overloads

TimeSpanValidator(TimeSpan, TimeSpan)

Initializes a new instance of the TimeSpanValidator class, based on supplied parameters.

TimeSpanValidator(TimeSpan, TimeSpan, Boolean)

Initializes a new instance of the TimeSpanValidator class, based on supplied parameters.

TimeSpanValidator(TimeSpan, TimeSpan, Boolean, Int64)

Initializes a new instance of the TimeSpanValidator class, based on supplied parameters.

TimeSpanValidator(TimeSpan, TimeSpan)

Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs

Initializes a new instance of the TimeSpanValidator class, based on supplied parameters.

public:
 TimeSpanValidator(TimeSpan minValue, TimeSpan maxValue);
public TimeSpanValidator (TimeSpan minValue, TimeSpan maxValue);
new System.Configuration.TimeSpanValidator : TimeSpan * TimeSpan -> System.Configuration.TimeSpanValidator
Public Sub New (minValue As TimeSpan, maxValue As TimeSpan)

Parameters

minValue
TimeSpan

A TimeSpan object that specifies the minimum time allowed to pass validation.

maxValue
TimeSpan

A TimeSpan object that specifies the maximum time allowed to pass validation.

Remarks

When the TimeSpanValidator constructor with two parameters is used, the TimeSpanValidator object validates that a TimeSpan value adheres to a specific range.

Applies to

TimeSpanValidator(TimeSpan, TimeSpan, Boolean)

Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs

Initializes a new instance of the TimeSpanValidator class, based on supplied parameters.

public:
 TimeSpanValidator(TimeSpan minValue, TimeSpan maxValue, bool rangeIsExclusive);
public TimeSpanValidator (TimeSpan minValue, TimeSpan maxValue, bool rangeIsExclusive);
new System.Configuration.TimeSpanValidator : TimeSpan * TimeSpan * bool -> System.Configuration.TimeSpanValidator
Public Sub New (minValue As TimeSpan, maxValue As TimeSpan, rangeIsExclusive As Boolean)

Parameters

minValue
TimeSpan

A TimeSpan object that specifies the minimum time allowed to pass validation.

maxValue
TimeSpan

A TimeSpan object that specifies the maximum time allowed to pass validation.

rangeIsExclusive
Boolean

A Boolean value that specifies whether the validation range is exclusive.

Remarks

The TimeSpanValidator constructor checks both the minimum and maximum TimeSpan values, as well as whether the validation range is exclusive. When the rangeIsExclusive parameter is set to true, the TimeSpan value must not be between the minValue and maxValue values.

Applies to

TimeSpanValidator(TimeSpan, TimeSpan, Boolean, Int64)

Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs
Source:
TimeSpanValidator.cs

Initializes a new instance of the TimeSpanValidator class, based on supplied parameters.

public:
 TimeSpanValidator(TimeSpan minValue, TimeSpan maxValue, bool rangeIsExclusive, long resolutionInSeconds);
public TimeSpanValidator (TimeSpan minValue, TimeSpan maxValue, bool rangeIsExclusive, long resolutionInSeconds);
new System.Configuration.TimeSpanValidator : TimeSpan * TimeSpan * bool * int64 -> System.Configuration.TimeSpanValidator
Public Sub New (minValue As TimeSpan, maxValue As TimeSpan, rangeIsExclusive As Boolean, resolutionInSeconds As Long)

Parameters

minValue
TimeSpan

A TimeSpan object that specifies the minimum time allowed to pass validation.

maxValue
TimeSpan

A TimeSpan object that specifies the maximum time allowed to pass validation.

rangeIsExclusive
Boolean

A Boolean value that specifies whether the validation range is exclusive.

resolutionInSeconds
Int64

An Int64 value that specifies a number of seconds.

Exceptions

resolutionInSeconds is less than 0.

-or-

minValue is greater than maxValue.

Examples

The following code example demonstrates how to use the TimeSpanValidator constructor. This code example is part of a larger example provided for the TimeSpanValidator class.

// Create TimeSpan and Validator.
TimeSpan testTimeSpan = new TimeSpan(0,1,05);
TimeSpan minTimeSpan = new TimeSpan(0,1,0);
TimeSpan maxTimeSpan = new TimeSpan(0,1,10);
TimeSpanValidator myTimeSpanValidator = new TimeSpanValidator(minTimeSpan, maxTimeSpan, false, 65);
' Create string and validator.
Dim testVal As String = "filename"
Dim myStrValidator As StringValidator = New StringValidator(1, 8, "$%^")

Remarks

When the resolutionInSeconds parameter is specified, the TimeSpan object being validated must be equal to this value in order to pass validation.

Applies to