ArgumentNullGuard.

ThrowIfNull<T>(T, string) Method

Summary

Throws an System.ArgumentNullException if argument is null.
Namespace
oehen.arguard
Containing Type
ArgumentNullGuard

Syntax

public static T ThrowIfNull<T>(this T argument, string nameOfArgument)

Examples

Throws when the argument `objArgument` is null.

var localVar = objArgument.ThrowIfNull(nameof(objArgument));

Type Parameters

Name Description
T

Parameters

Name Type Description
argument T Argument value.
nameOfArgument string Name of the argument.

Return Value

Type Description
T
GitHub