diff --git a/Microsoft.Toolkit.Diagnostics/Attributes/DoesNotReturnAttribute.cs b/Microsoft.Toolkit.Diagnostics/Attributes/DoesNotReturnAttribute.cs
deleted file mode 100644
index 5f11632ac18..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Attributes/DoesNotReturnAttribute.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if !NETSTANDARD2_1_OR_GREATER
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Applied to a method that will never return under any circumstance.
- ///
- /// Internal copy from the BCL attribute.
- [AttributeUsage(AttributeTargets.Method, Inherited = false)]
- internal sealed class DoesNotReturnAttribute : Attribute
- {
- }
-}
-
-#endif
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Diagnostics/Attributes/DoesNotReturnIfAttribute.cs b/Microsoft.Toolkit.Diagnostics/Attributes/DoesNotReturnIfAttribute.cs
deleted file mode 100644
index 06799235131..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Attributes/DoesNotReturnIfAttribute.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if !NETSTANDARD2_1_OR_GREATER
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that a given also indicates
- /// whether the method will not return (eg. throw an exception).
- ///
- /// Internal copy from the BCL attribute.
- [AttributeUsage(AttributeTargets.Parameter)]
- internal sealed class DoesNotReturnIfAttribute : Attribute
- {
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// The condition parameter value. Code after the method will be considered unreachable
- /// by diagnostics if the argument to the associated parameter matches this value.
- ///
- public DoesNotReturnIfAttribute(bool parameterValue)
- {
- ParameterValue = parameterValue;
- }
-
- ///
- /// Gets a value indicating whether the parameter value should be .
- ///
- public bool ParameterValue { get; }
- }
-}
-
-#endif
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Diagnostics/Attributes/NotNullAttribute.cs b/Microsoft.Toolkit.Diagnostics/Attributes/NotNullAttribute.cs
deleted file mode 100644
index 4595d9d9cd7..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Attributes/NotNullAttribute.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if !NETSTANDARD2_1_OR_GREATER
-
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Specifies that an output will not be even if the corresponding type allows it.
- /// Specifies that an input argument was not when the call returns.
- ///
- /// Internal copy from the BCL attribute.
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]
- internal sealed class NotNullAttribute : Attribute
- {
- }
-}
-
-#endif
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Diagnostics/Attributes/SkipLocalsInitAttribute.cs b/Microsoft.Toolkit.Diagnostics/Attributes/SkipLocalsInitAttribute.cs
deleted file mode 100644
index 39d119f6ad2..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Attributes/SkipLocalsInitAttribute.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if !NET5_0
-
-namespace System.Runtime.CompilerServices
-{
- ///
- /// Used to indicate to the compiler that the .locals init flag should not be set in method headers.
- ///
- /// Internal copy from the BCL attribute.
- [AttributeUsage(
- AttributeTargets.Module |
- AttributeTargets.Class |
- AttributeTargets.Struct |
- AttributeTargets.Interface |
- AttributeTargets.Constructor |
- AttributeTargets.Method |
- AttributeTargets.Property |
- AttributeTargets.Event,
- Inherited = false)]
- internal sealed class SkipLocalsInitAttribute : Attribute
- {
- }
-}
-
-#endif
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Diagnostics/Extensions/TypeExtensions.cs b/Microsoft.Toolkit.Diagnostics/Extensions/TypeExtensions.cs
deleted file mode 100644
index 0791e2c0433..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Extensions/TypeExtensions.cs
+++ /dev/null
@@ -1,225 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.Contracts;
-using System.Linq;
-#if NETSTANDARD1_4
-using System.Reflection;
-#endif
-using System.Runtime.CompilerServices;
-
-namespace Microsoft.Toolkit.Diagnostics
-{
- ///
- /// Helpers for working with types.
- ///
- public static class TypeExtensions
- {
- ///
- /// The mapping of built-in types to their simple representation.
- ///
- private static readonly IReadOnlyDictionary BuiltInTypesMap = new Dictionary
- {
- [typeof(bool)] = "bool",
- [typeof(byte)] = "byte",
- [typeof(sbyte)] = "sbyte",
- [typeof(short)] = "short",
- [typeof(ushort)] = "ushort",
- [typeof(char)] = "char",
- [typeof(int)] = "int",
- [typeof(uint)] = "uint",
- [typeof(float)] = "float",
- [typeof(long)] = "long",
- [typeof(ulong)] = "ulong",
- [typeof(double)] = "double",
- [typeof(decimal)] = "decimal",
- [typeof(object)] = "object",
- [typeof(string)] = "string",
- [typeof(void)] = "void"
- };
-
- ///
- /// A thread-safe mapping of precomputed string representation of types.
- ///
- private static readonly ConditionalWeakTable DisplayNames = new ConditionalWeakTable();
-
- ///
- /// Returns a simple string representation of a type.
- ///
- /// The input type.
- /// The string representation of .
- [Pure]
- public static string ToTypeString(this Type type)
- {
- // Local function to create the formatted string for a given type
- static string FormatDisplayString(Type type, int genericTypeOffset, ReadOnlySpan typeArguments)
- {
- // Primitive types use the keyword name
- if (BuiltInTypesMap.TryGetValue(type, out string? typeName))
- {
- return typeName!;
- }
-
- // Array types are displayed as Foo[]
- if (type.IsArray)
- {
- var elementType = type.GetElementType()!;
- var rank = type.GetArrayRank();
-
- return $"{FormatDisplayString(elementType, 0, elementType.GetGenericArguments())}[{new string(',', rank - 1)}]";
- }
-
- // By checking generic types here we are only interested in specific cases,
- // ie. nullable value types or value typles. We have a separate path for custom
- // generic types, as we can't rely on this API in that case, as it doesn't show
- // a difference between nested types that are themselves generic, or nested simple
- // types from a generic declaring type. To deal with that, we need to manually track
- // the offset within the array of generic arguments for the whole constructed type.
- if (type.IsGenericType())
- {
- var genericTypeDefinition = type.GetGenericTypeDefinition();
-
- // Nullable types are displayed as T?
- if (genericTypeDefinition == typeof(Nullable<>))
- {
- var nullableArguments = type.GetGenericArguments();
-
- return $"{FormatDisplayString(nullableArguments[0], 0, nullableArguments)}?";
- }
-
- // ValueTuple types are displayed as (T1, T2)
- if (genericTypeDefinition == typeof(ValueTuple<>) ||
- genericTypeDefinition == typeof(ValueTuple<,>) ||
- genericTypeDefinition == typeof(ValueTuple<,,>) ||
- genericTypeDefinition == typeof(ValueTuple<,,,>) ||
- genericTypeDefinition == typeof(ValueTuple<,,,,>) ||
- genericTypeDefinition == typeof(ValueTuple<,,,,,>) ||
- genericTypeDefinition == typeof(ValueTuple<,,,,,,>) ||
- genericTypeDefinition == typeof(ValueTuple<,,,,,,,>))
- {
- var formattedTypes = type.GetGenericArguments().Select(t => FormatDisplayString(t, 0, t.GetGenericArguments()));
-
- return $"({string.Join(", ", formattedTypes)})";
- }
- }
-
- string displayName;
-
- // Generic types
- if (type.Name.Contains('`'))
- {
- // Retrieve the current generic arguments for the current type (leaf or not)
- var tokens = type.Name.Split('`');
- var genericArgumentsCount = int.Parse(tokens[1]);
- var typeArgumentsOffset = typeArguments.Length - genericTypeOffset - genericArgumentsCount;
- var currentTypeArguments = typeArguments.Slice(typeArgumentsOffset, genericArgumentsCount).ToArray();
- var formattedTypes = currentTypeArguments.Select(t => FormatDisplayString(t, 0, t.GetGenericArguments()));
-
- // Standard generic types are displayed as Foo
- displayName = $"{tokens[0]}<{string.Join(", ", formattedTypes)}>";
-
- // Track the current offset for the shared generic arguments list
- genericTypeOffset += genericArgumentsCount;
- }
- else
- {
- // Simple custom types
- displayName = type.Name;
- }
-
- // If the type is nested, recursively format the hierarchy as well
- if (type.IsNested)
- {
- var openDeclaringType = type.DeclaringType!;
- var rootGenericArguments = typeArguments.Slice(0, typeArguments.Length - genericTypeOffset).ToArray();
-
- // If the declaring type is generic, we need to reconstruct the closed type
- // manually, as the declaring type instance doesn't retain type information.
- if (rootGenericArguments.Length > 0)
- {
- var closedDeclaringType = openDeclaringType.GetGenericTypeDefinition().MakeGenericType(rootGenericArguments);
-
- return $"{FormatDisplayString(closedDeclaringType, genericTypeOffset, typeArguments)}.{displayName}";
- }
-
- return $"{FormatDisplayString(openDeclaringType, genericTypeOffset, typeArguments)}.{displayName}";
- }
-
- return $"{type.Namespace}.{displayName}";
- }
-
- // Atomically get or build the display string for the current type.
- return DisplayNames.GetValue(type, t =>
- {
- // By-ref types are displayed as T&
- if (t.IsByRef)
- {
- t = t.GetElementType()!;
-
- return $"{FormatDisplayString(t, 0, t.GetGenericArguments())}&";
- }
-
- // Pointer types are displayed as T*
- if (t.IsPointer)
- {
- int depth = 0;
-
- // Calculate the pointer indirection level
- while (t.IsPointer)
- {
- depth++;
- t = t.GetElementType()!;
- }
-
- return $"{FormatDisplayString(t, 0, t.GetGenericArguments())}{new string('*', depth)}";
- }
-
- // Standard path for concrete types
- return FormatDisplayString(t, 0, t.GetGenericArguments());
- });
- }
-
- ///
- /// Returns whether or not a given type is generic.
- ///
- /// The input type.
- /// Whether or not the input type is generic.
- [Pure]
- private static bool IsGenericType(this Type type)
- {
-#if NETSTANDARD1_4
- return type.GetTypeInfo().IsGenericType;
-#else
- return type.IsGenericType;
-#endif
- }
-
-#if NETSTANDARD1_4
- ///
- /// Returns an array of types representing the generic arguments.
- ///
- /// The input type.
- /// An array of types representing the generic arguments.
- [Pure]
- private static Type[] GetGenericArguments(this Type type)
- {
- return type.GetTypeInfo().GenericTypeParameters;
- }
-
- ///
- /// Returns whether is an instance of .
- ///
- /// The input type.
- /// The type to check against.
- /// if is an instance of , otherwise.
- [Pure]
- internal static bool IsInstanceOfType(this Type type, object value)
- {
- return type.GetTypeInfo().IsAssignableFrom(value.GetType().GetTypeInfo());
- }
-#endif
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Diagnostics/Extensions/ValueTypeExtensions.cs b/Microsoft.Toolkit.Diagnostics/Extensions/ValueTypeExtensions.cs
deleted file mode 100644
index 8f1e6fbe97a..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Extensions/ValueTypeExtensions.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace Microsoft.Toolkit.Diagnostics
-{
- ///
- /// Helpers for working with value types.
- ///
- public static class ValueTypeExtensions
- {
- ///
- /// Gets the table of hex characters (doesn't allocate, maps to .text section, see ).
- ///
- private static ReadOnlySpan HexCharactersTable => new[]
- {
- (byte)'0', (byte)'1', (byte)'2', (byte)'3',
- (byte)'4', (byte)'5', (byte)'6', (byte)'7',
- (byte)'8', (byte)'9', (byte)'A', (byte)'B',
- (byte)'C', (byte)'D', (byte)'E', (byte)'F'
- };
-
- ///
- /// Returns a hexadecimal representation of a given value, left-padded and ordered as big-endian.
- ///
- /// The input type to format to .
- /// The input value to format to .
- ///
- /// The hexadecimal representation of (with the '0x' prefix), left-padded to byte boundaries and ordered as big-endian.
- ///
- ///
- /// As a byte (8 bits) is represented by two hexadecimal digits (each representing a group of 4 bytes), each
- /// representation will always contain an even number of digits. For instance:
- ///
- /// Console.WriteLine(1.ToHexString()); // "0x01"
- /// Console.WriteLine(((byte)255).ToHexString()); // "0xFF"
- /// Console.WriteLine((-1).ToHexString()); // "0xFFFFFFFF"
- ///
- ///
- [Pure]
- [SkipLocalsInit]
- public static unsafe string ToHexString(this T value)
- where T : unmanaged
- {
- int
- sizeOfT = Unsafe.SizeOf(),
- bufferSize = (2 * sizeOfT) + 2;
- char* p = stackalloc char[bufferSize];
-
- p[0] = '0';
- p[1] = 'x';
-
- ref byte rh = ref MemoryMarshal.GetReference(HexCharactersTable);
-
- for (int i = 0, j = bufferSize - 2; i < sizeOfT; i++, j -= 2)
- {
- byte b = ((byte*)&value)[i];
- int
- low = b & 0x0F,
- high = (b & 0xF0) >> 4;
-
- p[j + 1] = (char)Unsafe.Add(ref rh, low);
- p[j] = (char)Unsafe.Add(ref rh, high);
- }
-
- return new string(p, 0, bufferSize);
- }
- }
-}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Diagnostics/Generated/Guard.Collection.g.cs b/Microsoft.Toolkit.Diagnostics/Generated/Guard.Collection.g.cs
deleted file mode 100644
index 454bc3b7d70..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Generated/Guard.Collection.g.cs
+++ /dev/null
@@ -1,1827 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// =====================
-// Auto generated file
-// =====================
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-
-namespace Microsoft.Toolkit.Diagnostics
-{
- ///
- /// Helper methods to verify conditions when running code.
- ///
- public static partial class Guard
- {
- ///
- /// Asserts that the input instance must be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(Span span, string name)
- {
- if (span.Length == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty(span, name);
- }
-
- ///
- /// Asserts that the input instance must not be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(Span span, string name)
- {
- if (span.Length != 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEmptyWithSpan(name);
- }
-
- ///
- /// Asserts that the input instance must have a size of a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(Span span, int size, string name)
- {
- if (span.Length == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(Span span, int size, string name)
- {
- if (span.Length != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size over a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(Span span, int size, string name)
- {
- if (span.Length > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(Span span, int size, string name)
- {
- if (span.Length >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(Span span, int size, string name)
- {
- if (span.Length < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(Span span, int size, string name)
- {
- if (span.Length <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(span, size, name);
- }
-
- ///
- /// Asserts that the source instance must have the same size of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(Span source, Span destination, string name)
- {
- if (source.Length == destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the source instance must have a size of less than or equal to that of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(Span source, Span destination, string name)
- {
- if (source.Length <= destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the input index is valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, Span span, string name)
- {
- if ((uint)index < (uint)span.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, span, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, Span span, string name)
- {
- if ((uint)index >= (uint)span.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, span, name);
- }
-
- ///
- /// Asserts that the input instance must be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(ReadOnlySpan span, string name)
- {
- if (span.Length == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty(span, name);
- }
-
- ///
- /// Asserts that the input instance must not be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(ReadOnlySpan span, string name)
- {
- if (span.Length != 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEmptyWithReadOnlySpan(name);
- }
-
- ///
- /// Asserts that the input instance must have a size of a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(ReadOnlySpan span, int size, string name)
- {
- if (span.Length == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(ReadOnlySpan span, int size, string name)
- {
- if (span.Length != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size over a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(ReadOnlySpan span, int size, string name)
- {
- if (span.Length > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(ReadOnlySpan span, int size, string name)
- {
- if (span.Length >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(ReadOnlySpan span, int size, string name)
- {
- if (span.Length < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan(span, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(ReadOnlySpan span, int size, string name)
- {
- if (span.Length <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(span, size, name);
- }
-
- ///
- /// Asserts that the source instance must have the same size of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(ReadOnlySpan source, Span destination, string name)
- {
- if (source.Length == destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the source instance must have a size of less than or equal to that of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(ReadOnlySpan source, Span destination, string name)
- {
- if (source.Length <= destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the input index is valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, ReadOnlySpan span, string name)
- {
- if ((uint)index < (uint)span.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, span, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, ReadOnlySpan span, string name)
- {
- if ((uint)index >= (uint)span.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, span, name);
- }
-
- ///
- /// Asserts that the input instance must be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(Memory memory, string name)
- {
- if (memory.Length == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty(memory, name);
- }
-
- ///
- /// Asserts that the input instance must not be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(Memory memory, string name)
- {
- if (memory.Length != 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEmpty>(name);
- }
-
- ///
- /// Asserts that the input instance must have a size of a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(Memory memory, int size, string name)
- {
- if (memory.Length == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(Memory memory, int size, string name)
- {
- if (memory.Length != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size over a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(Memory memory, int size, string name)
- {
- if (memory.Length > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(Memory memory, int size, string name)
- {
- if (memory.Length >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(Memory memory, int size, string name)
- {
- if (memory.Length < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(Memory memory, int size, string name)
- {
- if (memory.Length <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(memory, size, name);
- }
-
- ///
- /// Asserts that the source instance must have the same size of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(Memory source, Memory destination, string name)
- {
- if (source.Length == destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the source instance must have a size of less than or equal to that of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(Memory source, Memory destination, string name)
- {
- if (source.Length <= destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the input index is valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, Memory memory, string name)
- {
- if ((uint)index < (uint)memory.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, memory, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, Memory memory, string name)
- {
- if ((uint)index >= (uint)memory.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, memory, name);
- }
-
- ///
- /// Asserts that the input instance must be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(ReadOnlyMemory memory, string name)
- {
- if (memory.Length == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty(memory, name);
- }
-
- ///
- /// Asserts that the input instance must not be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(ReadOnlyMemory memory, string name)
- {
- if (memory.Length != 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEmpty>(name);
- }
-
- ///
- /// Asserts that the input instance must have a size of a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(ReadOnlyMemory memory, int size, string name)
- {
- if (memory.Length == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(ReadOnlyMemory memory, int size, string name)
- {
- if (memory.Length != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size over a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(ReadOnlyMemory memory, int size, string name)
- {
- if (memory.Length > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(ReadOnlyMemory memory, int size, string name)
- {
- if (memory.Length >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(ReadOnlyMemory memory, int size, string name)
- {
- if (memory.Length < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan(memory, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(ReadOnlyMemory memory, int size, string name)
- {
- if (memory.Length <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(memory, size, name);
- }
-
- ///
- /// Asserts that the source instance must have the same size of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(ReadOnlyMemory source, Memory destination, string name)
- {
- if (source.Length == destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the source instance must have a size of less than or equal to that of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(ReadOnlyMemory source, Memory destination, string name)
- {
- if (source.Length <= destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the input index is valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, ReadOnlyMemory memory, string name)
- {
- if ((uint)index < (uint)memory.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, memory, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, ReadOnlyMemory memory, string name)
- {
- if ((uint)index >= (uint)memory.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, memory, name);
- }
-
- ///
- /// Asserts that the input array instance must be empty.
- ///
- /// The item of items in the input array instance.
- /// The input array instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(T[] array, string name)
- {
- if (array.Length == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty(array, name);
- }
-
- ///
- /// Asserts that the input array instance must not be empty.
- ///
- /// The item of items in the input array instance.
- /// The input array instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(T[] array, string name)
- {
- if (array.Length != 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEmpty(name);
- }
-
- ///
- /// Asserts that the input array instance must have a size of a specified value.
- ///
- /// The item of items in the input array instance.
- /// The input array instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(T[] array, int size, string name)
- {
- if (array.Length == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(array, size, name);
- }
-
- ///
- /// Asserts that the input array instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input array instance.
- /// The input array instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(T[] array, int size, string name)
- {
- if (array.Length != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo(array, size, name);
- }
-
- ///
- /// Asserts that the input array instance must have a size over a specified value.
- ///
- /// The item of items in the input array instance.
- /// The input array instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(T[] array, int size, string name)
- {
- if (array.Length > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(array, size, name);
- }
-
- ///
- /// Asserts that the input array instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input array instance.
- /// The input array instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(T[] array, int size, string name)
- {
- if (array.Length >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(array, size, name);
- }
-
- ///
- /// Asserts that the input array instance must have a size of less than a specified value.
- ///
- /// The item of items in the input array instance.
- /// The input array instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(T[] array, int size, string name)
- {
- if (array.Length < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan(array, size, name);
- }
-
- ///
- /// Asserts that the input array instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input array instance.
- /// The input array instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(T[] array, int size, string name)
- {
- if (array.Length <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(array, size, name);
- }
-
- ///
- /// Asserts that the source array instance must have the same size of a destination array instance.
- ///
- /// The item of items in the input array instance.
- /// The source array instance to check the size for.
- /// The destination array instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(T[] source, T[] destination, string name)
- {
- if (source.Length == destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the source array instance must have a size of less than or equal to that of a destination array instance.
- ///
- /// The item of items in the input array instance.
- /// The source array instance to check the size for.
- /// The destination array instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(T[] source, T[] destination, string name)
- {
- if (source.Length <= destination.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(source, destination, name);
- }
-
- ///
- /// Asserts that the input index is valid for a given array instance.
- ///
- /// The item of items in the input array instance.
- /// The input index to be used to access .
- /// The input array instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, T[] array, string name)
- {
- if ((uint)index < (uint)array.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, array, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given array instance.
- ///
- /// The item of items in the input array instance.
- /// The input index to be used to access .
- /// The input array instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, T[] array, string name)
- {
- if ((uint)index >= (uint)array.Length)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, array, name);
- }
-
- ///
- /// Asserts that the input instance must be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(List list, string name)
- {
- if (list.Count == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty((ICollection)list, name);
- }
-
- ///
- /// Asserts that the input instance must not be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(List list, string name)
- {
- if (list.Count != 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEmpty>(name);
- }
-
- ///
- /// Asserts that the input instance must have a size of a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(List list, int size, string name)
- {
- if (list.Count == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo((ICollection)list, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(List list, int size, string name)
- {
- if (list.Count != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo((ICollection)list, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size over a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(List list, int size, string name)
- {
- if (list.Count > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan((ICollection)list, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(List list, int size, string name)
- {
- if (list.Count >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo((ICollection)list, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(List list, int size, string name)
- {
- if (list.Count < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan((ICollection)list, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(List list, int size, string name)
- {
- if (list.Count <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo((ICollection)list, size, name);
- }
-
- ///
- /// Asserts that the source instance must have the same size of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(List source, List destination, string name)
- {
- if (source.Count == destination.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo((ICollection)source, destination.Count, name);
- }
-
- ///
- /// Asserts that the source instance must have a size of less than or equal to that of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(List source, List destination, string name)
- {
- if (source.Count <= destination.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo((ICollection)source, destination.Count, name);
- }
-
- ///
- /// Asserts that the input index is valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, List list, string name)
- {
- if ((uint)index < (uint)list.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, (ICollection)list, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, List list, string name)
- {
- if ((uint)index >= (uint)list.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, (ICollection)list, name);
- }
-
- ///
- /// Asserts that the input instance must be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(ICollection collection, string name)
- {
- if (collection.Count == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty(collection, name);
- }
-
- ///
- /// Asserts that the input instance must not be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(ICollection collection, string name)
- {
- if (collection.Count != 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEmpty>(name);
- }
-
- ///
- /// Asserts that the input instance must have a size of a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(ICollection collection, int size, string name)
- {
- if (collection.Count == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(ICollection collection, int size, string name)
- {
- if (collection.Count != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size over a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(ICollection collection, int size, string name)
- {
- if (collection.Count > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(ICollection collection, int size, string name)
- {
- if (collection.Count >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(ICollection collection, int size, string name)
- {
- if (collection.Count < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(ICollection collection, int size, string name)
- {
- if (collection.Count <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(collection, size, name);
- }
-
- ///
- /// Asserts that the source instance must have the same size of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(ICollection source, ICollection destination, string name)
- {
- if (source.Count == destination.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination.Count, name);
- }
-
- ///
- /// Asserts that the source instance must have a size of less than or equal to that of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(ICollection source, ICollection destination, string name)
- {
- if (source.Count <= destination.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination.Count, name);
- }
-
- ///
- /// Asserts that the input index is valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, ICollection collection, string name)
- {
- if ((uint)index < (uint)collection.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, collection, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, ICollection collection, string name)
- {
- if ((uint)index >= (uint)collection.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, collection, name);
- }
-
- ///
- /// Asserts that the input instance must be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(IReadOnlyCollection collection, string name)
- {
- if (collection.Count == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty(collection, name);
- }
-
- ///
- /// Asserts that the input instance must not be empty.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(IReadOnlyCollection collection, string name)
- {
- if (collection.Count != 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEmpty>(name);
- }
-
- ///
- /// Asserts that the input instance must have a size of a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(IReadOnlyCollection collection, int size, string name)
- {
- if (collection.Count == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(IReadOnlyCollection collection, int size, string name)
- {
- if (collection.Count != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size over a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(IReadOnlyCollection collection, int size, string name)
- {
- if (collection.Count > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(IReadOnlyCollection collection, int size, string name)
- {
- if (collection.Count >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(IReadOnlyCollection collection, int size, string name)
- {
- if (collection.Count < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan(collection, size, name);
- }
-
- ///
- /// Asserts that the input instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input instance.
- /// The input instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(IReadOnlyCollection collection, int size, string name)
- {
- if (collection.Count <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(collection, size, name);
- }
-
- ///
- /// Asserts that the source instance must have the same size of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(IReadOnlyCollection source, ICollection destination, string name)
- {
- if (source.Count == destination.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination.Count, name);
- }
-
- ///
- /// Asserts that the source instance must have a size of less than or equal to that of a destination instance.
- ///
- /// The item of items in the input instance.
- /// The source instance to check the size for.
- /// The destination instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(IReadOnlyCollection source, ICollection destination, string name)
- {
- if (source.Count <= destination.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, destination.Count, name);
- }
-
- ///
- /// Asserts that the input index is valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, IReadOnlyCollection collection, string name)
- {
- if ((uint)index < (uint)collection.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, collection, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given instance.
- ///
- /// The item of items in the input instance.
- /// The input index to be used to access .
- /// The input instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, IReadOnlyCollection collection, string name)
- {
- if ((uint)index >= (uint)collection.Count)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, collection, name);
- }
- }
-}
diff --git a/Microsoft.Toolkit.Diagnostics/Generated/Guard.Collection.tt b/Microsoft.Toolkit.Diagnostics/Generated/Guard.Collection.tt
deleted file mode 100644
index 22bf00947e7..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Generated/Guard.Collection.tt
+++ /dev/null
@@ -1,301 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-<#@include file="TypeInfo.ttinclude" #>
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-
-namespace Microsoft.Toolkit.Diagnostics
-{
- ///
- /// Helper methods to verify conditions when running code.
- ///
- public static partial class Guard
- {
-<#
-GenerateTextForItems(EnumerableTypes, item =>
-{
-#>
- ///
- /// Asserts that the input <#=item.XmlType#> instance must be empty.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input <#=item.XmlType#> instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEmpty(<#=item.Type#> <#=item.Name#>, string name)
- {
- if (<#=item.Name#>.<#=item.Size#> == 0)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEmpty(<#=item.Cast#><#=item.Name#>, name);
- }
-
- ///
- /// Asserts that the input <#=item.XmlType#> instance must not be empty.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input <#=item.XmlType#> instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == 0.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEmpty(<#=item.Type#> <#=item.Name#>, string name)
- {
- if (<#=item.Name#>.<#=item.Size#> != 0)
- {
- return;
- }
-
-<#
- if (item.Type == "Span")
- {
-#>
- ThrowHelper.ThrowArgumentExceptionForIsNotEmptyWithSpan(name);
-<#
- }
- else if (item.Type == "ReadOnlySpan")
- {
-#>
- ThrowHelper.ThrowArgumentExceptionForIsNotEmptyWithReadOnlySpan(name);
-<#
- }
- else
- {
-#>
- ThrowHelper.ThrowArgumentExceptionForIsNotEmpty<<#=item.Type#>>(name);
-<#
- }
-#>
- }
-
- ///
- /// Asserts that the input <#=item.XmlType#> instance must have a size of a specified value.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input <#=item.XmlType#> instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(<#=item.Type#> <#=item.Name#>, int size, string name)
- {
- if (<#=item.Name#>.<#=item.Size#> == size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(<#=item.Cast#><#=item.Name#>, size, name);
- }
-
- ///
- /// Asserts that the input <#=item.XmlType#> instance must have a size not equal to a specified value.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input <#=item.XmlType#> instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is == .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeNotEqualTo(<#=item.Type#> <#=item.Name#>, int size, string name)
- {
- if (<#=item.Name#>.<#=item.Size#> != size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeNotEqualTo(<#=item.Cast#><#=item.Name#>, size, name);
- }
-
- ///
- /// Asserts that the input <#=item.XmlType#> instance must have a size over a specified value.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input <#=item.XmlType#> instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is <= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThan(<#=item.Type#> <#=item.Name#>, int size, string name)
- {
- if (<#=item.Name#>.<#=item.Size#> > size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(<#=item.Cast#><#=item.Name#>, size, name);
- }
-
- ///
- /// Asserts that the input <#=item.XmlType#> instance must have a size of at least or equal to a specified value.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input <#=item.XmlType#> instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is < .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeGreaterThanOrEqualTo(<#=item.Type#> <#=item.Name#>, int size, string name)
- {
- if (<#=item.Name#>.<#=item.Size#> >= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(<#=item.Cast#><#=item.Name#>, size, name);
- }
-
- ///
- /// Asserts that the input <#=item.XmlType#> instance must have a size of less than a specified value.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input <#=item.XmlType#> instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is >= .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThan(<#=item.Type#> <#=item.Name#>, int size, string name)
- {
- if (<#=item.Name#>.<#=item.Size#> < size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThan(<#=item.Cast#><#=item.Name#>, size, name);
- }
-
- ///
- /// Asserts that the input <#=item.XmlType#> instance must have a size of less than or equal to a specified value.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input <#=item.XmlType#> instance to check the size for.
- /// The target size to test.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(<#=item.Type#> <#=item.Name#>, int size, string name)
- {
- if (<#=item.Name#>.<#=item.Size#> <= size)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(<#=item.Cast#><#=item.Name#>, size, name);
- }
-
- ///
- /// Asserts that the source <#=item.XmlType#> instance must have the same size of a destination <#=item.XmlType#> instance.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The source <#=item.XmlType#> instance to check the size for.
- /// The destination <#=item.XmlType#> instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is != the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeEqualTo(<#=item.Type#> source, <#=item.DestinationType#> destination, string name)
- {
- if (source.<#=item.Size#> == destination.<#=item.Size#>)
- {
- return;
- }
-
-<#
- if (item.HasCountProperty)
- {
-#>
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(<#=item.Cast#>source, destination.<#=item.Size#>, name);
-<#
- }
- else
- {
-#>
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(source, <#=item.Cast#>destination, name);
-<#
- }
-#>
- }
-
- ///
- /// Asserts that the source <#=item.XmlType#> instance must have a size of less than or equal to that of a destination <#=item.XmlType#> instance.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The source <#=item.XmlType#> instance to check the size for.
- /// The destination <#=item.XmlType#> instance to check the size for.
- /// The name of the input parameter being tested.
- /// Thrown if the size of is > the one of .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void HasSizeLessThanOrEqualTo(<#=item.Type#> source, <#=item.DestinationType#> destination, string name)
- {
- if (source.<#=item.Size#> <= destination.<#=item.Size#>)
- {
- return;
- }
-
-<#
- if (item.HasCountProperty)
- {
-#>
- ThrowHelper.ThrowArgumentExceptionForHasSizeEqualTo(<#=item.Cast#>source, destination.<#=item.Size#>, name);
-<#
- }
- else
- {
-#>
- ThrowHelper.ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(source, <#=item.Cast#>destination, name);
-<#
- }
-#>
- }
-
- ///
- /// Asserts that the input index is valid for a given <#=item.XmlType#> instance.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input index to be used to access .
- /// The input <#=item.XmlType#> instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is not valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRangeFor(int index, <#=item.Type#> <#=item.Name#>, string name)
- {
-<#
- // Here we're leveraging the fact that signed integers are represented
- // in 2-complement to perform the bounds check with a single compare operation.
- // This is the same trick used throughout CoreCLR as well.
- // For more info and code sample, see the original conversation here:
- // https://github.com/CommunityToolkit/WindowsCommunityToolkit/pull/3131#discussion_r390682835
-#>
- if ((uint)index < (uint)<#=item.Name#>.<#=item.Size#>)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRangeFor(index, <#=item.Cast#><#=item.Name#>, name);
- }
-
- ///
- /// Asserts that the input index is not valid for a given <#=item.XmlType#> instance.
- ///
- /// The item of items in the input <#=item.XmlType#> instance.
- /// The input index to be used to access .
- /// The input <#=item.XmlType#> instance to use to validate .
- /// The name of the input parameter being tested.
- /// Thrown if is valid to access .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRangeFor(int index, <#=item.Type#> <#=item.Name#>, string name)
- {
- if ((uint)index >= (uint)<#=item.Name#>.<#=item.Size#>)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, <#=item.Cast#><#=item.Name#>, name);
- }
-<#
-});
-#>
- }
-}
diff --git a/Microsoft.Toolkit.Diagnostics/Generated/Guard.Comparable.Numeric.g.cs b/Microsoft.Toolkit.Diagnostics/Generated/Guard.Comparable.Numeric.g.cs
deleted file mode 100644
index 953f007578b..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Generated/Guard.Comparable.Numeric.g.cs
+++ /dev/null
@@ -1,3532 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// =====================
-// Auto generated file
-// =====================
-
-using System;
-using System.Runtime.CompilerServices;
-
-namespace Microsoft.Toolkit.Diagnostics
-{
- ///
- /// Helper methods to verify conditions when running code.
- ///
- public static partial class Guard
- {
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(byte value, byte target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(byte value, byte target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(byte value, byte maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(byte value, byte maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(byte value, byte minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(byte value, byte minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(byte value, byte minimum, byte maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(byte value, byte minimum, byte maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(byte value, byte minimum, byte maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(byte value, byte minimum, byte maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(byte value, byte minimum, byte maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(byte value, byte minimum, byte maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(sbyte value, sbyte target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(sbyte value, sbyte target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(sbyte value, sbyte maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(sbyte value, sbyte maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(sbyte value, sbyte minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(sbyte value, sbyte minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(sbyte value, sbyte minimum, sbyte maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(sbyte value, sbyte minimum, sbyte maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(sbyte value, sbyte minimum, sbyte maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(sbyte value, sbyte minimum, sbyte maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(sbyte value, sbyte minimum, sbyte maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(sbyte value, sbyte minimum, sbyte maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(short value, short target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(short value, short target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(short value, short maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(short value, short maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(short value, short minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(short value, short minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(short value, short minimum, short maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(short value, short minimum, short maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(short value, short minimum, short maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(short value, short minimum, short maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(short value, short minimum, short maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(short value, short minimum, short maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(ushort value, ushort target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(ushort value, ushort target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(ushort value, ushort maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(ushort value, ushort maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(ushort value, ushort minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(ushort value, ushort minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(ushort value, ushort minimum, ushort maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(ushort value, ushort minimum, ushort maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(ushort value, ushort minimum, ushort maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(ushort value, ushort minimum, ushort maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(ushort value, ushort minimum, ushort maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(ushort value, ushort minimum, ushort maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(char value, char target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(char value, char target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(char value, char maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(char value, char maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(char value, char minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(char value, char minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(char value, char minimum, char maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(char value, char minimum, char maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(char value, char minimum, char maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(char value, char minimum, char maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(char value, char minimum, char maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(char value, char minimum, char maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(int value, int target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(int value, int target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(int value, int maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(int value, int maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(int value, int minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(int value, int minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(int value, int minimum, int maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(int value, int minimum, int maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(int value, int minimum, int maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(int value, int minimum, int maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(int value, int minimum, int maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(int value, int minimum, int maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(uint value, uint target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(uint value, uint target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(uint value, uint maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(uint value, uint maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(uint value, uint minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(uint value, uint minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(uint value, uint minimum, uint maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(uint value, uint minimum, uint maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(uint value, uint minimum, uint maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(uint value, uint minimum, uint maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(uint value, uint minimum, uint maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(uint value, uint minimum, uint maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(float value, float target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(float value, float target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(float value, float maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(float value, float maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(float value, float minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(float value, float minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(float value, float minimum, float maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(float value, float minimum, float maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(float value, float minimum, float maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(float value, float minimum, float maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(float value, float minimum, float maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(float value, float minimum, float maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(long value, long target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(long value, long target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(long value, long maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(long value, long maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(long value, long minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(long value, long minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(long value, long minimum, long maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(long value, long minimum, long maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(long value, long minimum, long maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(long value, long minimum, long maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(long value, long minimum, long maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(long value, long minimum, long maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(ulong value, ulong target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(ulong value, ulong target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(ulong value, ulong maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(ulong value, ulong maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(ulong value, ulong minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(ulong value, ulong minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(ulong value, ulong minimum, ulong maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(ulong value, ulong minimum, ulong maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(ulong value, ulong minimum, ulong maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(ulong value, ulong minimum, ulong maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(ulong value, ulong minimum, ulong maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(ulong value, ulong minimum, ulong maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(double value, double target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(double value, double target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(double value, double maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(double value, double maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(double value, double minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(double value, double minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(double value, double minimum, double maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(double value, double minimum, double maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(double value, double minimum, double maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(double value, double minimum, double maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(double value, double minimum, double maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(double value, double minimum, double maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(decimal value, decimal target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(decimal value, decimal target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(decimal value, decimal maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(decimal value, decimal maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(decimal value, decimal minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(decimal value, decimal minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(decimal value, decimal minimum, decimal maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(decimal value, decimal minimum, decimal maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(decimal value, decimal minimum, decimal maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(decimal value, decimal minimum, decimal maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(decimal value, decimal minimum, decimal maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(decimal value, decimal minimum, decimal maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(nint value, nint target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(nint value, nint target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(nint value, nint maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(nint value, nint maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(nint value, nint minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(nint value, nint minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(nint value, nint minimum, nint maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(nint value, nint minimum, nint maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(nint value, nint minimum, nint maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(nint value, nint minimum, nint maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(nint value, nint minimum, nint maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(nint value, nint minimum, nint maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(nuint value, nuint target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input value to test.
- /// The target value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(nuint value, nuint target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input value to test.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(nuint value, nuint maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(nuint value, nuint maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(nuint value, nuint minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(nuint value, nuint minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or >= .
- ///
- /// This API asserts the equivalent of " in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsInRange(nuint value, nuint minimum, nuint maximum, string name)
- {
- if (value >= minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given range.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or < .
- ///
- /// This API asserts the equivalent of " not in [, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotInRange(nuint value, nuint minimum, nuint maximum, string name)
- {
- if (value < minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRange(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= or >= .
- ///
- /// This API asserts the equivalent of " in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetween(nuint value, nuint minimum, nuint maximum, string name)
- {
- if (value > minimum && value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The exclusive minimum value that is accepted.
- /// The exclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > or < .
- ///
- /// This API asserts the equivalent of " not in (, )", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetween(nuint value, nuint minimum, nuint maximum, string name)
- {
- if (value <= minimum || value >= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetween(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < or > .
- ///
- /// This API asserts the equivalent of " in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsBetweenOrEqualTo(nuint value, nuint minimum, nuint maximum, string name)
- {
- if (value >= minimum && value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo(value, minimum, maximum, name);
- }
-
- ///
- /// Asserts that the input value must not be in a given interval.
- ///
- /// The input value to test.
- /// The inclusive minimum value that is accepted.
- /// The inclusive maximum value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= or <= .
- ///
- /// This API asserts the equivalent of " not in [, ]", using arithmetic notation.
- /// The method is generic to avoid boxing the parameters, if they are value types.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotBetweenOrEqualTo(nuint value, nuint minimum, nuint maximum, string name)
- {
- if (value < minimum || value > maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotBetweenOrEqualTo(value, minimum, maximum, name);
- }
- }
-}
diff --git a/Microsoft.Toolkit.Diagnostics/Generated/Guard.Comparable.Numeric.tt b/Microsoft.Toolkit.Diagnostics/Generated/Guard.Comparable.Numeric.tt
deleted file mode 100644
index 3f5f0032b06..00000000000
--- a/Microsoft.Toolkit.Diagnostics/Generated/Guard.Comparable.Numeric.tt
+++ /dev/null
@@ -1,274 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-<#@include file="TypeInfo.ttinclude" #>
-using System;
-using System.Runtime.CompilerServices;
-
-namespace Microsoft.Toolkit.Diagnostics
-{
- ///
- /// Helper methods to verify conditions when running code.
- ///
- public static partial class Guard
- {
-<#
-GenerateTextForItems(NumericTypes, typeInfo =>
-{
- var (type, prefix) = typeInfo;
-#>
- ///
- /// Asserts that the input value must be equal to a specified value.
- ///
- /// The input ="<#=type#>"/> value to test.
- /// The target ="<#=type#>"/> value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is != .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsEqualTo(<#=type#> value, <#=type#> target, string name)
- {
- if (value == target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be not equal to a specified value.
- ///
- /// The input ="<#=type#>"/> value to test.
- /// The target ="<#=type#>"/> value to test for.
- /// The name of the input parameter being tested.
- /// Thrown if is == .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsNotEqualTo(<#=type#> value, <#=type#> target, string name)
- {
- if (value != target)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentExceptionForIsNotEqualTo(value, target, name);
- }
-
- ///
- /// Asserts that the input value must be less than a specified value.
- ///
- /// The input ="<#=type#>"/> value to test.
- /// The exclusive maximum ="<#=type#>"/> value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is >= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThan(<#=type#> value, <#=type#> maximum, string name)
- {
- if (value < maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThan(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be less than or equal to a specified value.
- ///
- /// The input ="<#=type#>"/> value to test.
- /// The inclusive maximum ="<#=type#>"/> value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is > .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsLessThanOrEqualTo(<#=type#> value, <#=type#> maximum, string name)
- {
- if (value <= maximum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo(value, maximum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than a specified value.
- ///
- /// The input ="<#=type#>"/> value to test.
- /// The exclusive minimum ="<#=type#>"/> value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is <= .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThan(<#=type#> value, <#=type#> minimum, string name)
- {
- if (value > minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThan(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be greater than or equal to a specified value.
- ///
- /// The input ="<#=type#>"/> value to test.
- /// The inclusive minimum ="<#=type#>"/> value that is accepted.
- /// The name of the input parameter being tested.
- /// Thrown if is < .
- /// The method is generic to avoid boxing the parameters, if they are value types.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void IsGreaterThanOrEqualTo(<#=type#> value, <#=type#> minimum, string name)
- {
- if (value >= minimum)
- {
- return;
- }
-
- ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo(value, minimum, name);
- }
-
- ///
- /// Asserts that the input value must be in a given range.
- ///
- /// The input ="<#=type#>"/> value to test.
- /// The inclusive minimum ="<#=type#>"/> value that is accepted.
- ///