ArgumentOutOfRangeException.ThrowIfEqual<T>(T, T, String) Method

Definition

Throws an ArgumentOutOfRangeException if value is equal to other.

C#
public static void ThrowIfEqual<T>(T value, T other, string? paramName = default) where T : IEquatable<T>;

Type Parameters

T

The type of the objects to validate.

Parameters

value
T

The argument to validate as not equal to other.

other
T

The value to compare with value.

paramName
String

The name of the parameter with which value corresponds.

Applies to

Product Versions
.NET 8, 9