ArgumentNullException.ThrowIfNull Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ThrowIfNull(Object, String) |
Throws an ArgumentNullException if |
ThrowIfNull(Void*, String) |
Throws an ArgumentNullException if |
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
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應