Table of Contents

Method ThrowIfNull

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

ThrowIfNull(object, string)

Throws an ArgumentNullException if the given argument is null.

public static void ThrowIfNull(this object argument, string argName)

Parameters

argument object

An argument to check.

argName string

The name of the argument.

Exceptions

ArgumentNullException

argument is null.

ThrowIfNull<T>(T, string)

Throws an ArgumentNullException if the object is null.

public static T ThrowIfNull<T>(this T obj, string objArgName = null)

Parameters

obj T

The object to check.

objArgName string

The name of the argument.

Returns

T

The original object if it is not null.

Type Parameters

T

The type of the object.

Exceptions

ArgumentNullException

obj is null.