ArgumentEqualGuard.

ThrowIfNotEqual<T>(T, T, string) Method

Summary

Throws an System.InvalidOperationException if argument is not equal compareArgument .
Namespace
oehen.arguard
Containing Type
ArgumentEqualGuard

Syntax

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

Examples

Throws when argument and compareArgument are not equal.

var localVar = argument.ThrowIfNotEqual(nameof(argument), compareArgument);

Type Parameters

Name Description
T Generic argument type.

Parameters

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

Return Value

Type Description
T
GitHub