ArgumentNullException.ThrowIfNull(Object, String) Method

Definition

Throws an ArgumentNullException if argument is null.

public static void ThrowIfNull (object? argument, string? paramName = default);
static member ThrowIfNull : obj * string -> unit
Public Shared Sub ThrowIfNull (argument As Object, Optional paramName As String = Nothing)

Parameters

argument
Object

The reference type argument to validate as non-null.

paramName
String

The name of the parameter with which argument corresponds.

Exceptions

argument is null.

Applies to