Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TimeSpanValidator Constructor (TimeSpan, TimeSpan, Boolean, Int64)

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

Namespace:  System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

public TimeSpanValidator(
	TimeSpan minValue,
	TimeSpan maxValue,
	bool rangeIsExclusive,
	long resolutionInSeconds


Type: System.TimeSpan

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

Type: System.TimeSpan

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

Type: System.Boolean

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

Type: System.Int64

An Int64 value that specifies a number of seconds.


resolutionInSeconds is less than 0.

- or -

minValue is greater than maxValue.

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

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);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft