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.ThrowIfLessThan Method

Overloads  
ThrowIfLessThan<T>(this T, T, string) Returns the value once confirmed to be at least minimum, otherwise throws.
ThrowIfLessThan<T>(this T, T, IComparer<T>, string) Returns the value once confirmed to be at least minimum, otherwise throws. Uses the given comparer.

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

Returns the value once confirmed to be at least minimum, otherwise throws.

public static T ThrowIfLessThan<T>(this T value, T minimum, string paramName);

Type parameters

T

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

Parameters

value T

The value to check.

minimum T

The lowest value that is allowed.

paramName System.String

The name of the parameter to report in the exception.

Returns

T
value, once confirmed to be at least minimum.

Exceptions

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

System.ArgumentOutOfRangeException
Thrown when value is less than minimum.

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

Returns the value once confirmed to be at least minimum, otherwise throws. Uses the given comparer.

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

Type parameters

T

The type being compared.

Parameters

value T

The value to check.

minimum T

The lowest value that is allowed.

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 at least minimum.

Exceptions

System.ArgumentOutOfRangeException
Thrown when value is less than minimum.