View on GitHub
Clean Architecture Toolkit for .NET
Clean Architecture Toolkit is a clean, modular architecture foundation for .NET applications.
It embraces SOLID principles and focuses on maintainability, testability, and scalability through clear boundaries and pluggable design.

|   HOME   |   MODULE OVERVIEW   |   DEMO   |   CAT.EXTENSIONS   |

Code Reference

» Cat.Object.Extensions Assembly » Cat.Object.Extensions Namespace » ObjectExtensions Class

ObjectExtensions.ThrowIfLessThanOrEqualTo Method

Overloads  
ThrowIfLessThanOrEqualTo<T>(this T, T, string) Returns the value once confirmed to be higher than limit, otherwise throws.
ThrowIfLessThanOrEqualTo<T>(this T, T, IComparer<T>, string) Returns the value once confirmed to be higher than limit, otherwise throws. Uses the given comparer.

ObjectExtensions.ThrowIfLessThanOrEqualTo<T>(this T, T, string) Method

Returns the value once confirmed to be higher than limit, otherwise throws.

public static T ThrowIfLessThanOrEqualTo<T>(this T value, T limit, string paramName);

Type parameters

T

The type being compared. Must implement System.IComparable<>.

Parameters

value T

The value to check.

limit T

The value that value must be higher than.

paramName System.String

The name of the parameter to report in the exception.

Returns

T
value, once confirmed to be higher than limit.

Exceptions

System.ArgumentException
Thrown when T doesn’t implement System.IComparable<>.

System.ArgumentOutOfRangeException
Thrown when value is less than or equal to limit.

ObjectExtensions.ThrowIfLessThanOrEqualTo<T>(this T, T, IComparer<T>, string) Method

Returns the value once confirmed to be higher than limit, otherwise throws. Uses the given comparer.

public static T ThrowIfLessThanOrEqualTo<T>(this T value, T limit, System.Collections.Generic.IComparer<T> comparer, string paramName);

Type parameters

T

The type being compared.

Parameters

value T

The value to check.

limit T

The value that value must be higher than.

comparer System.Collections.Generic.IComparer<T>

The comparer to use.

paramName System.String

The name of the parameter to report in the exception.

Returns

T
value, once confirmed to be higher than limit.

Exceptions

System.ArgumentOutOfRangeException
Thrown when value is less than or equal to limit.