Code Analysis Code Analysis
Code Analysis Code Analysis
DocFX + Singulink = ♥

Search Results for

    Method ThrowIfNullRefArgument

    ThrowIfNullRefArgument<T>(ref readonly T, string?)

    Throws an ArgumentNullException that names the argument if a reference is a null reference, as NullRef<T>() makes one, and does nothing else.

    Declaration
    public static void ThrowIfNullRefArgument<T>(ref readonly T argument, string? paramName = null) where T : allows ref struct
    Parameters
    Type Name Description
    T argument

    The reference to check.

    string paramName

    The name of the argument, which the compiler fills in.

    Type Parameters
    Name Description
    T

    The type of what the reference refers to.

    Remarks

    Use this one for a ref, in or out parameter of a public method, where a null reference is the fault of the caller. Everywhere else ThrowIfNullRef<T>(ref readonly T, string?) is the one to use. After a call of this method the reference is known to refer to something, as after a call of that one.

    Exceptions
    Type Condition
    ArgumentNullException

    argument is a null reference.

    © Singulink. All rights reserved.