Guard.IsCloseTo Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- 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
- 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
- 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
- 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
.