 | DateTimeExtensionsEqualWithinTolerance Method |
Determines if 2 DateTime values contain the same Date and Time to within
the specified tolerance. That is, if the tolerance specified is 1 second,
the DateTime values would have to be within 1 second of each other to match.
Namespace:
TestHelperExtensions
Assembly:
CBI.TestHelperExtensions (in CBI.TestHelperExtensions.dll) Version: 2.1.0.1
Syntaxpublic static bool EqualWithinTolerance(
this DateTime objectUnderTest,
DateTime comparisonValue,
TimeSpan tolerance
)
<ExtensionAttribute>
Public Shared Function EqualWithinTolerance (
objectUnderTest As DateTime,
comparisonValue As DateTime,
tolerance As TimeSpan
) As Boolean
public:
[ExtensionAttribute]
static bool EqualWithinTolerance(
DateTime objectUnderTest,
DateTime comparisonValue,
TimeSpan tolerance
)
[<ExtensionAttribute>]
static member EqualWithinTolerance :
objectUnderTest : DateTime *
comparisonValue : DateTime *
tolerance : TimeSpan -> bool
Parameters
- objectUnderTest
- Type: SystemDateTime
A DateTime representing the primary value being tested. - comparisonValue
- Type: SystemDateTime
A DateTime representing the value being compared to the primary value. - tolerance
- Type: SystemTimeSpan
A TimeSpan representing the maximum discrepancy between
the 2 values for the DateTime values to be considered a match.
Return Value
Type:
BooleanA boolean value indicating if the 2 values are equal within the specified tolerance.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
DateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also