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

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

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

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

public static T ThrowIfGreaterThanOrEqualTo<T>(this T value, T limit, string valueName, string limitName);

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 less than.

valueName System.String

The name of value to report in the exception.

limitName System.String

The name of limit to report in the exception.

Returns

T
value, once confirmed to be less than limit.

Exceptions

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

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

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

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

public static T ThrowIfGreaterThanOrEqualTo<T>(this T value, T limit, System.Collections.Generic.IComparer<T> comparer, string valueName, string limitName);

Type parameters

T

The type being compared.

Parameters

value T

The value to check.

limit T

The value that value must be less than.

comparer System.Collections.Generic.IComparer<T>

The comparer to use.

valueName System.String

The name of value to report in the exception.

limitName System.String

The name of limit to report in the exception.

Returns

T
value, once confirmed to be less than limit.

Exceptions

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