共用方式為


ArgumentOutOfRangeException.ThrowIfEqual<T>(T, T, String) 方法

定義

如果 value 等於 other ,則會擲回 ArgumentOutOfRangeException

public static void ThrowIfEqual<T> (T value, T other, string? paramName = default) where T : IEquatable<T>;
static member ThrowIfEqual : 'T * 'T * string -> unit (requires 'T :> IEquatable<'T>)
Public Shared Sub ThrowIfEqual(Of T As IEquatable(Of T)) (value As T, other As T, Optional paramName As String = Nothing)

類型參數

T

要驗證的物件型別。

參數

value
T

要驗證為不等於 other 的引數。

other
T

要與 value 比較的值。

paramName
String

對應之參數 value 的名稱。

適用於