diff --git a/Microsoft.Toolkit/Diagnostics/Generated/Guard.Comparable.Numeric.g.cs b/Microsoft.Toolkit/Diagnostics/Generated/Guard.Comparable.Numeric.g.cs
index 8f911a4cd41..431c65f2aa6 100644
--- a/Microsoft.Toolkit/Diagnostics/Generated/Guard.Comparable.Numeric.g.cs
+++ b/Microsoft.Toolkit/Diagnostics/Generated/Guard.Comparable.Numeric.g.cs
@@ -3026,5 +3026,507 @@ public static void IsNotBetweenOrEqualTo(decimal value, decimal minimum, decimal
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
index 4977a75660e..7e0bd9db3b7 100644
--- a/Microsoft.Toolkit/Diagnostics/Generated/Guard.Comparable.Numeric.tt
+++ b/Microsoft.Toolkit/Diagnostics/Generated/Guard.Comparable.Numeric.tt
@@ -13,14 +13,15 @@ namespace Microsoft.Toolkit.Diagnostics
public static partial class Guard
{
<#
-GenerateTextForItems(NumericTypes, type =>
+GenerateTextForItems(NumericTypes, typeInfo =>
{
+ var (type, prefix) = typeInfo;
#>
///
/// Asserts that the input value must be equal to a specified value.
///
- /// The input value to test.
- /// The target value to test for.
+ /// 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)]
@@ -37,8 +38,8 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 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.
@@ -56,8 +57,8 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 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.
@@ -75,8 +76,8 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 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.
@@ -94,8 +95,8 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 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.
@@ -113,8 +114,8 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 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.
@@ -132,9 +133,9 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 input ="<#=type#>"/> value to test.
+ /// The inclusive minimum ="<#=type#>"/> value that is accepted.
+ /// The exclusive maximum ="<#=type#>"/> value that is accepted.
/// The name of the input parameter being tested.
/// Thrown if is < or >= .
///
@@ -155,9 +156,9 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 input ="<#=type#>"/> value to test.
+ /// The inclusive minimum ="<#=type#>"/> value that is accepted.
+ /// The exclusive maximum ="<#=type#>"/> value that is accepted.
/// The name of the input parameter being tested.
/// Thrown if is >= or < .
///
@@ -178,9 +179,9 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 input ="<#=type#>"/> value to test.
+ /// The exclusive minimum ="<#=type#>"/> value that is accepted.
+ /// The exclusive maximum ="<#=type#>"/> value that is accepted.
/// The name of the input parameter being tested.
/// Thrown if is <= or >= .
///
@@ -201,9 +202,9 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 input ="<#=type#>"/> value to test.
+ /// The exclusive minimum ="<#=type#>"/> value that is accepted.
+ /// The exclusive maximum ="<#=type#>"/> value that is accepted.
/// The name of the input parameter being tested.
/// Thrown if is > or < .
///
@@ -224,9 +225,9 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 input ="<#=type#>"/> value to test.
+ /// The inclusive minimum ="<#=type#>"/> value that is accepted.
+ /// The inclusive maximum ="<#=type#>"/> value that is accepted.
/// The name of the input parameter being tested.
/// Thrown if is < or > .
///
@@ -247,9 +248,9 @@ GenerateTextForItems(NumericTypes, type =>
///
/// 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 input ="<#=type#>"/> value to test.
+ /// The inclusive minimum ="<#=type#>"/> value that is accepted.
+ /// The inclusive maximum ="<#=type#>"/> value that is accepted.
/// The name of the input parameter being tested.
/// Thrown if is >= or <= .
///
diff --git a/Microsoft.Toolkit/Diagnostics/Generated/ThrowHelper.Collection.g.cs b/Microsoft.Toolkit/Diagnostics/Generated/ThrowHelper.Collection.g.cs
index e75e6c5081d..1499c68fccc 100644
--- a/Microsoft.Toolkit/Diagnostics/Generated/ThrowHelper.Collection.g.cs
+++ b/Microsoft.Toolkit/Diagnostics/Generated/ThrowHelper.Collection.g.cs
@@ -8,894 +8,811 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
-using System.Runtime.CompilerServices;
using Microsoft.Toolkit.Extensions;
namespace Microsoft.Toolkit.Diagnostics
{
///
- /// Helper methods to efficiently throw exceptions.
+ /// Helper methods to verify conditions when running code.
///
- public static partial class ThrowHelper
+ public static partial class Guard
{
///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForIsEmpty(Span span, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must be empty, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(Span span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must have a size equal to {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeNotEqualTo(Span span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must have a size not equal to {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThan(Span span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must have a size over {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(Span span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must have a size of at least {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThan(Span span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must have a size less than {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(Span span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must have a size less than or equal to {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(Span source, Span destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must have a size equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(Span source, Span destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(Span).ToTypeString()}) must have a size less than or equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, Span span, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must be in the range given by <0> and {span.Length.ToAssertString()} to be a valid index for the target collection ({typeof(Span).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(int index, Span span, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must not be in the range given by <0> and {span.Length.ToAssertString()} to be an invalid index for the target collection ({typeof(Span).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForIsEmpty(ReadOnlySpan span, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must be empty, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(ReadOnlySpan span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must have a size equal to {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeNotEqualTo(ReadOnlySpan span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must have a size not equal to {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThan(ReadOnlySpan span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must have a size over {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(ReadOnlySpan span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must have a size of at least {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThan(ReadOnlySpan span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must have a size less than {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(ReadOnlySpan span, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must have a size less than or equal to {size}, had a size of {span.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(ReadOnlySpan source, Span destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must have a size equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(ReadOnlySpan source, Span destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(ReadOnlySpan).ToTypeString()}) must have a size less than or equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, ReadOnlySpan span, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must be in the range given by <0> and {span.Length.ToAssertString()} to be a valid index for the target collection ({typeof(ReadOnlySpan).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(int index, ReadOnlySpan span, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must not be in the range given by <0> and {span.Length.ToAssertString()} to be an invalid index for the target collection ({typeof(ReadOnlySpan).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForIsEmpty(Memory memory, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must be empty, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(Memory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must have a size equal to {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeNotEqualTo(Memory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must have a size not equal to {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThan(Memory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must have a size over {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(Memory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must have a size of at least {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThan(Memory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must have a size less than {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(Memory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must have a size less than or equal to {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(Memory source, Memory destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must have a size equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(Memory source, Memory destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(Memory).ToTypeString()}) must have a size less than or equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, Memory memory, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must be in the range given by <0> and {memory.Length.ToAssertString()} to be a valid index for the target collection ({typeof(Memory).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(int index, Memory memory, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must not be in the range given by <0> and {memory.Length.ToAssertString()} to be an invalid index for the target collection ({typeof(Memory).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForIsEmpty(ReadOnlyMemory memory, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must be empty, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(ReadOnlyMemory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must have a size equal to {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeNotEqualTo(ReadOnlyMemory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must have a size not equal to {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThan(ReadOnlyMemory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must have a size over {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(ReadOnlyMemory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must have a size of at least {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThan(ReadOnlyMemory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must have a size less than {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(ReadOnlyMemory memory, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must have a size less than or equal to {size}, had a size of {memory.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(ReadOnlyMemory source, Memory destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must have a size equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(ReadOnlyMemory source, Memory destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(ReadOnlyMemory).ToTypeString()}) must have a size less than or equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, ReadOnlyMemory memory, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must be in the range given by <0> and {memory.Length.ToAssertString()} to be a valid index for the target collection ({typeof(ReadOnlyMemory).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(int index, ReadOnlyMemory memory, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must not be in the range given by <0> and {memory.Length.ToAssertString()} to be an invalid index for the target collection ({typeof(ReadOnlyMemory).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForIsEmpty(T[] array, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must be empty, had a size of {array.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(T[] array, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must have a size equal to {size}, had a size of {array.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeNotEqualTo(T[] array, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must have a size not equal to {size}, had a size of {array.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThan(T[] array, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must have a size over {size}, had a size of {array.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(T[] array, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must have a size of at least {size}, had a size of {array.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThan(T[] array, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must have a size less than {size}, had a size of {array.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(T[] array, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must have a size less than or equal to {size}, had a size of {array.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(T[] source, T[] destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must have a size equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(T[] source, T[] destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(T[]).ToTypeString()}) must have a size less than or equal to {destination.Length.ToAssertString()} (the destination), had a size of {source.Length.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, T[] array, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must be in the range given by <0> and {array.Length.ToAssertString()} to be a valid index for the target collection ({typeof(T[]).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(int index, T[] array, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must not be in the range given by <0> and {array.Length.ToAssertString()} to be an invalid index for the target collection ({typeof(T[]).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForIsEmpty(List list, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(List).ToTypeString()}) must be empty, had a size of {list.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(List list, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(List).ToTypeString()}) must have a size equal to {size}, had a size of {list.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeNotEqualTo(List list, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(List).ToTypeString()}) must have a size not equal to {size}, had a size of {list.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThan(List list, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(List).ToTypeString()}) must have a size over {size}, had a size of {list.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(List list, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(List).ToTypeString()}) must have a size of at least {size}, had a size of {list.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThan(List list, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(List).ToTypeString()}) must have a size less than {size}, had a size of {list.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(List list, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(List).ToTypeString()}) must have a size less than or equal to {size}, had a size of {list.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(List source, List destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(List).ToTypeString()}) must have a size equal to {destination.Count.ToAssertString()} (the destination), had a size of {source.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(List source, List destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(List).ToTypeString()}) must have a size less than or equal to {destination.Count.ToAssertString()} (the destination), had a size of {source.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, List list, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must be in the range given by <0> and {list.Count.ToAssertString()} to be a valid index for the target collection ({typeof(List).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(int index, List list, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must not be in the range given by <0> and {list.Count.ToAssertString()} to be an invalid index for the target collection ({typeof(List).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForIsEmpty(ICollection collection, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must be empty, had a size of {collection.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(ICollection collection, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must have a size equal to {size}, had a size of {collection.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeNotEqualTo(ICollection collection, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must have a size not equal to {size}, had a size of {collection.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThan(ICollection collection, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must have a size over {size}, had a size of {collection.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(ICollection collection, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must have a size of at least {size}, had a size of {collection.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThan(ICollection collection, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must have a size less than {size}, had a size of {collection.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(ICollection collection, int size, string name)
- {
- ThrowArgumentException(name, $"Parameter {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must have a size less than or equal to {size}, had a size of {collection.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeEqualTo(ICollection source, ICollection destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must have a size equal to {destination.Count.ToAssertString()} (the destination), had a size of {source.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(ICollection source, ICollection destination, string name)
- {
- ThrowArgumentException(name, $"The source {name.ToAssertString()} ({typeof(ICollection).ToTypeString()}) must have a size less than or equal to {destination.Count.ToAssertString()} (the destination), had a size of {source.Count.ToAssertString()}");
- }
-
- ///
- /// Throws an when (or an overload) fails.
- ///
- [MethodImpl(MethodImplOptions.NoInlining)]
- [DoesNotReturn]
- internal static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, ICollection collection, string name)
- {
- ThrowArgumentOutOfRangeException(name, index, $"Parameter {name.ToAssertString()} (int) must be in the range given by <0> and {collection.Count.ToAssertString()} to be a valid index for the target collection ({typeof(ICollection).ToTypeString()}), was {index.ToAssertString()}");
- }
-
- ///