Upraviť

Zdieľať cez


ArgumentNullException.ThrowIfNull Method

Definition

Overloads

ThrowIfNull(Object, String)

Throws an ArgumentNullException if argument is null.

ThrowIfNull(Void*, String)

Throws an ArgumentNullException if argument is null.

ThrowIfNull(Object, String)

Source:
ArgumentNullException.cs
Source:
ArgumentNullException.cs
Source:
ArgumentNullException.cs

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. If you omit this parameter, the name of argument is used.

Exceptions

argument is null.

Remarks

The paramName parameter is included to support the CallerArgumentExpressionAttribute attribute. It's recommended that you don't pass a value for this parameter and let the name of argument be used instead.

Applies to

ThrowIfNull(Void*, String)

Source:
ArgumentNullException.cs
Source:
ArgumentNullException.cs
Source:
ArgumentNullException.cs

Important

This API is not CLS-compliant.

Throws an ArgumentNullException if argument is null.

[System.CLSCompliant(false)]
public static void ThrowIfNull (void* argument, string? paramName = default);
[<System.CLSCompliant(false)>]
static member ThrowIfNull : nativeptr<unit> * string -> unit

Parameters

argument
Void*

The pointer argument to validate as non-null.

paramName
String

The name of the parameter with which argument corresponds.

Attributes

Applies to