Guard.IsCloseTo Method

Definition

Overloads

IsCloseTo(Single, Single, Single, String)

Asserts that the input value must be within a given distance from a specified value.

IsCloseTo(IntPtr, IntPtr, UIntPtr, String)

Asserts that the input value must be within a given distance from a specified value.

IsCloseTo(Double, Double, Double, String)

Asserts that the input value must be within a given distance from a specified value.

IsCloseTo(Int32, Int32, UInt32, String)

Asserts that the input value must be within a given distance from a specified value.

IsCloseTo(Int64, Int64, UInt64, String)

Asserts that the input value must be within a given distance from a specified value.

IsCloseTo(Single, Single, Single, String)

Asserts that the input value must be within a given distance from a specified value.

public static void IsCloseTo (float value, float target, float delta, string name);
static member IsCloseTo : single * single * single * string -> unit
Public Shared Sub IsCloseTo (value As Single, target As Single, delta As Single, name As String)

Parameters

value
Single

The input Single value to test.

target
Single

The target Single value to test for.

delta
Single

The maximum distance to allow between value and target.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if (value - target) > delta.

Applies to

IsCloseTo(IntPtr, IntPtr, UIntPtr, String)

Asserts that the input value must be within a given distance from a specified value.

public static void IsCloseTo (nint value, nint target, nuint delta, string name);
static member IsCloseTo : nativeint * nativeint * unativeint * string -> unit
Public Shared Sub IsCloseTo (value As IntPtr, target As IntPtr, delta As UIntPtr, name As String)

Parameters

value
IntPtr

nint

nativeint

The input nint value to test.

target
IntPtr

nint

nativeint

The target nint value to test for.

delta
UIntPtr

nuint

unativeint

The maximum distance to allow between value and target.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if (value - target) > delta.

Applies to

IsCloseTo(Double, Double, Double, String)

Asserts that the input value must be within a given distance from a specified value.

public static void IsCloseTo (double value, double target, double delta, string name);
static member IsCloseTo : double * double * double * string -> unit
Public Shared Sub IsCloseTo (value As Double, target As Double, delta As Double, name As String)

Parameters

value
Double

The input Double value to test.

target
Double

The target Double value to test for.

delta
Double

The maximum distance to allow between value and target.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if (value - target) > delta.

Applies to

IsCloseTo(Int32, Int32, UInt32, String)

Asserts that the input value must be within a given distance from a specified value.

public static void IsCloseTo (int value, int target, uint delta, string name);
static member IsCloseTo : int * int * uint32 * string -> unit
Public Shared Sub IsCloseTo (value As Integer, target As Integer, delta As UInteger, name As String)

Parameters

value
Int32

The input Int32 value to test.

target
Int32

The target Int32 value to test for.

delta
UInt32

The maximum distance to allow between value and target.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if (value - target) > delta.

Applies to

IsCloseTo(Int64, Int64, UInt64, String)

Asserts that the input value must be within a given distance from a specified value.

public static void IsCloseTo (long value, long target, ulong delta, string name);
static member IsCloseTo : int64 * int64 * uint64 * string -> unit
Public Shared Sub IsCloseTo (value As Long, target As Long, delta As ULong, name As String)

Parameters

value
Int64

The input Int64 value to test.

target
Int64

The target Int64 value to test for.

delta
UInt64

The maximum distance to allow between value and target.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if (value - target) > delta.

Applies to