From 8ba03db8838ce23489bdc649fe45aa5c3e7aa299 Mon Sep 17 00:00:00 2001 From: Az <56699741+AlchlcDvl@users.noreply.github.com> Date: Wed, 18 Nov 2026 14:14:29 -0500 Subject: [PATCH] slightly better constructor --- MiraAPI/Utilities/SafeAcceptableValueRange.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/MiraAPI/Utilities/SafeAcceptableValueRange.cs b/MiraAPI/Utilities/SafeAcceptableValueRange.cs index ab80de2a..8dd4db97 100644 --- a/MiraAPI/Utilities/SafeAcceptableValueRange.cs +++ b/MiraAPI/Utilities/SafeAcceptableValueRange.cs @@ -28,15 +28,8 @@ public sealed class SafeAcceptableValueRange : AcceptableValueBase public SafeAcceptableValueRange(T min, T max) : base(typeof(T)) { - if (min is null) - { - throw new ArgumentNullException(nameof(min)); - } - - if (max is null) - { - throw new ArgumentNullException(nameof(max)); - } + ArgumentNullException.ThrowIfNull(min); + ArgumentNullException.ThrowIfNull(max); if (min.CompareTo(max) > 0) { @@ -59,7 +52,7 @@ public sealed class SafeAcceptableValueRange : AcceptableValueBase if (val.CompareTo(Min) <= 0) return Min; - if (val.CompareTo(Max) >= 0) + if (val.CompareTo(Max) > 0) return Max; return val;