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

Extension methods for argument validation.

public static class ObjectExtensions

Inheritance System.Object → ObjectExtensions

Methods  
CompareDefault<T>(T, T) Compares two values using T’s default comparison.
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.
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.
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.
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.
ThrowIfNull<T>(this T, string) Returns the argument once confirmed non-null, otherwise throws.