| 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.ThrowIfGreaterThan Method
| Overloads | |
|---|---|
| ThrowIfGreaterThan<T>(this T, T, string) | Returns the value once confirmed to be at most maximum, otherwise throws. |
| ThrowIfGreaterThan<T>(this T, T, IComparer<T>, string) | Returns the value once confirmed to be at most maximum, otherwise throws. Uses the given comparer. |
ObjectExtensions.ThrowIfGreaterThan<T>(this T, T, string) Method
Returns the value once confirmed to be at most maximum, otherwise throws.
public static T ThrowIfGreaterThan<T>(this T value, T maximum, string paramName);
Type parameters
T
The type being compared. Must implement System.IComparable<>.
Parameters
value T
The value to check.
maximum T
The highest 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 most maximum.
Exceptions
System.ArgumentException
Thrown when T doesn’t implement System.IComparable<>.
System.ArgumentOutOfRangeException
Thrown when value is greater than maximum.
ObjectExtensions.ThrowIfGreaterThan<T>(this T, T, IComparer<T>, string) Method
Returns the value once confirmed to be at most maximum, otherwise throws. Uses the given comparer.
public static T ThrowIfGreaterThan<T>(this T value, T maximum, System.Collections.Generic.IComparer<T> comparer, string paramName);
Type parameters
T
The type being compared.
Parameters
value T
The value to check.
maximum T
The highest 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 most maximum.
Exceptions
System.ArgumentOutOfRangeException
Thrown when value is greater than maximum.