Guard.IsInRange Method

Definition

Overloads

IsInRange(UInt64, UInt64, UInt64, String)

Asserts that the input value must be in a given range.

IsInRange(UInt16, UInt16, UInt16, String)

Asserts that the input value must be in a given range.

IsInRange(Single, Single, Single, String)

Asserts that the input value must be in a given range.

IsInRange(SByte, SByte, SByte, String)

Asserts that the input value must be in a given range.

IsInRange(IntPtr, IntPtr, IntPtr, String)

Asserts that the input value must be in a given range.

IsInRange(Int64, Int64, Int64, String)

Asserts that the input value must be in a given range.

IsInRange(UInt32, UInt32, UInt32, String)

Asserts that the input value must be in a given range.

IsInRange(Int16, Int16, Int16, String)

Asserts that the input value must be in a given range.

IsInRange(Int32, Int32, Int32, String)

Asserts that the input value must be in a given range.

IsInRange(Byte, Byte, Byte, String)

Asserts that the input value must be in a given range.

IsInRange(UIntPtr, UIntPtr, UIntPtr, String)

Asserts that the input value must be in a given range.

IsInRange(Decimal, Decimal, Decimal, String)

Asserts that the input value must be in a given range.

IsInRange(Double, Double, Double, String)

Asserts that the input value must be in a given range.

IsInRange(Char, Char, Char, String)

Asserts that the input value must be in a given range.

IsInRange<T>(T, T, T, String)

Asserts that the input value must be in a given range.

IsInRange(UInt64, UInt64, UInt64, String)

Asserts that the input value must be in a given range.

public static void IsInRange (ulong value, ulong minimum, ulong maximum, string name);
static member IsInRange : uint64 * uint64 * uint64 * string -> unit
Public Shared Sub IsInRange (value As ULong, minimum As ULong, maximum As ULong, name As String)

Parameters

value
UInt64

The input UInt64 value to test.

minimum
UInt64

The inclusive minimum UInt64 value that is accepted.

maximum
UInt64

The exclusive maximum UInt64 value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(UInt16, UInt16, UInt16, String)

Asserts that the input value must be in a given range.

public static void IsInRange (ushort value, ushort minimum, ushort maximum, string name);
static member IsInRange : uint16 * uint16 * uint16 * string -> unit
Public Shared Sub IsInRange (value As UShort, minimum As UShort, maximum As UShort, name As String)

Parameters

value
UInt16

The input UInt16 value to test.

minimum
UInt16

The inclusive minimum UInt16 value that is accepted.

maximum
UInt16

The exclusive maximum UInt16 value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(Single, Single, Single, String)

Asserts that the input value must be in a given range.

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

Parameters

value
Single

The input Single value to test.

minimum
Single

The inclusive minimum Single value that is accepted.

maximum
Single

The exclusive maximum Single value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(SByte, SByte, SByte, String)

Asserts that the input value must be in a given range.

public static void IsInRange (sbyte value, sbyte minimum, sbyte maximum, string name);
static member IsInRange : sbyte * sbyte * sbyte * string -> unit
Public Shared Sub IsInRange (value As SByte, minimum As SByte, maximum As SByte, name As String)

Parameters

value
SByte

The input SByte value to test.

minimum
SByte

The inclusive minimum SByte value that is accepted.

maximum
SByte

The exclusive maximum SByte value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(IntPtr, IntPtr, IntPtr, String)

Asserts that the input value must be in a given range.

public static void IsInRange (nint value, nint minimum, nint maximum, string name);
static member IsInRange : nativeint * nativeint * nativeint * string -> unit
Public Shared Sub IsInRange (value As IntPtr, minimum As IntPtr, maximum As IntPtr, name As String)

Parameters

value
IntPtr

nint

nativeint

The input nint value to test.

minimum
IntPtr

nint

nativeint

The inclusive minimum nint value that is accepted.

maximum
IntPtr

nint

nativeint

The exclusive maximum nint value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(Int64, Int64, Int64, String)

Asserts that the input value must be in a given range.

public static void IsInRange (long value, long minimum, long maximum, string name);
static member IsInRange : int64 * int64 * int64 * string -> unit
Public Shared Sub IsInRange (value As Long, minimum As Long, maximum As Long, name As String)

Parameters

value
Int64

The input Int64 value to test.

minimum
Int64

The inclusive minimum Int64 value that is accepted.

maximum
Int64

The exclusive maximum Int64 value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(UInt32, UInt32, UInt32, String)

Asserts that the input value must be in a given range.

public static void IsInRange (uint value, uint minimum, uint maximum, string name);
static member IsInRange : uint32 * uint32 * uint32 * string -> unit
Public Shared Sub IsInRange (value As UInteger, minimum As UInteger, maximum As UInteger, name As String)

Parameters

value
UInt32

The input UInt32 value to test.

minimum
UInt32

The inclusive minimum UInt32 value that is accepted.

maximum
UInt32

The exclusive maximum UInt32 value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(Int16, Int16, Int16, String)

Asserts that the input value must be in a given range.

public static void IsInRange (short value, short minimum, short maximum, string name);
static member IsInRange : int16 * int16 * int16 * string -> unit
Public Shared Sub IsInRange (value As Short, minimum As Short, maximum As Short, name As String)

Parameters

value
Int16

The input Int16 value to test.

minimum
Int16

The inclusive minimum Int16 value that is accepted.

maximum
Int16

The exclusive maximum Int16 value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(Int32, Int32, Int32, String)

Asserts that the input value must be in a given range.

public static void IsInRange (int value, int minimum, int maximum, string name);
static member IsInRange : int * int * int * string -> unit
Public Shared Sub IsInRange (value As Integer, minimum As Integer, maximum As Integer, name As String)

Parameters

value
Int32

The input Int32 value to test.

minimum
Int32

The inclusive minimum Int32 value that is accepted.

maximum
Int32

The exclusive maximum Int32 value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(Byte, Byte, Byte, String)

Asserts that the input value must be in a given range.

public static void IsInRange (byte value, byte minimum, byte maximum, string name);
static member IsInRange : byte * byte * byte * string -> unit
Public Shared Sub IsInRange (value As Byte, minimum As Byte, maximum As Byte, name As String)

Parameters

value
Byte

The input Byte value to test.

minimum
Byte

The inclusive minimum Byte value that is accepted.

maximum
Byte

The exclusive maximum Byte value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(UIntPtr, UIntPtr, UIntPtr, String)

Asserts that the input value must be in a given range.

public static void IsInRange (nuint value, nuint minimum, nuint maximum, string name);
static member IsInRange : unativeint * unativeint * unativeint * string -> unit
Public Shared Sub IsInRange (value As UIntPtr, minimum As UIntPtr, maximum As UIntPtr, name As String)

Parameters

value
UIntPtr

nuint

unativeint

The input nuint value to test.

minimum
UIntPtr

nuint

unativeint

The inclusive minimum nuint value that is accepted.

maximum
UIntPtr

nuint

unativeint

The exclusive maximum nuint value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(Decimal, Decimal, Decimal, String)

Asserts that the input value must be in a given range.

public static void IsInRange (decimal value, decimal minimum, decimal maximum, string name);
static member IsInRange : decimal * decimal * decimal * string -> unit
Public Shared Sub IsInRange (value As Decimal, minimum As Decimal, maximum As Decimal, name As String)

Parameters

value
Decimal

The input Decimal value to test.

minimum
Decimal

The inclusive minimum Decimal value that is accepted.

maximum
Decimal

The exclusive maximum Decimal value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(Double, Double, Double, String)

Asserts that the input value must be in a given range.

public static void IsInRange (double value, double minimum, double maximum, string name);
static member IsInRange : double * double * double * string -> unit
Public Shared Sub IsInRange (value As Double, minimum As Double, maximum As Double, name As String)

Parameters

value
Double

The input Double value to test.

minimum
Double

The inclusive minimum Double value that is accepted.

maximum
Double

The exclusive maximum Double value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange(Char, Char, Char, String)

Asserts that the input value must be in a given range.

public static void IsInRange (char value, char minimum, char maximum, string name);
static member IsInRange : char * char * char * string -> unit
Public Shared Sub IsInRange (value As Char, minimum As Char, maximum As Char, name As String)

Parameters

value
Char

The input Char value to test.

minimum
Char

The inclusive minimum Char value that is accepted.

maximum
Char

The exclusive maximum Char value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsInRange<T>(T, T, T, String)

Asserts that the input value must be in a given range.

public static void IsInRange<T> (T value, T minimum, T maximum, string name) where T : IComparable<T>;
static member IsInRange : 'T * 'T * 'T * string -> unit (requires 'T :> IComparable<'T>)
Public Shared Sub IsInRange(Of T As IComparable(Of T)) (value As T, minimum As T, maximum As T, name As String)

Type Parameters

T

The type of input values to compare.

Parameters

value
T

The input T value to test.

minimum
T

The inclusive minimum T value that is accepted.

maximum
T

The exclusive maximum T value that is accepted.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is < minimum or >= maximum.

Remarks

This API asserts the equivalent of "value in [minimum, maximum)", using arithmetic notation. The method is generic to avoid boxing the parameters, if they are value types.

Applies to