// 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 CommunityToolkit.Diagnostics;
///
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, [CallerArgumentExpression("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, [CallerArgumentExpression("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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("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, [CallerArgumentExpression("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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("span")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("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, [CallerArgumentExpression("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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("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, [CallerArgumentExpression("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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("memory")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("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, [CallerArgumentExpression("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, [CallerArgumentExpression("array")] 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, [CallerArgumentExpression("array")] 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, [CallerArgumentExpression("array")] 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, [CallerArgumentExpression("array")] 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, [CallerArgumentExpression("array")] 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, [CallerArgumentExpression("array")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("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, [CallerArgumentExpression("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, [CallerArgumentExpression("list")] 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, [CallerArgumentExpression("list")] 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, [CallerArgumentExpression("list")] 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, [CallerArgumentExpression("list")] 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, [CallerArgumentExpression("list")] 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, [CallerArgumentExpression("list")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("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, [CallerArgumentExpression("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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("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, [CallerArgumentExpression("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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("collection")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("source")] 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, [CallerArgumentExpression("index")] 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, [CallerArgumentExpression("index")] string name = "")
{
if ((uint)index >= (uint)collection.Count)
{
return;
}
ThrowHelper.ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(index, collection, name);
}
}