From 6f2d47c6306e46e28902fba181e2c9d2d114ff16 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Wed, 20 Nov 2024 18:27:54 +0000 Subject: [PATCH] Make 'name' default to CallerArgumentExpression for convenience --- src/client/spark_core/utils/Exceptions/ExceptionAssert.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/spark_core/utils/Exceptions/ExceptionAssert.cs b/src/client/spark_core/utils/Exceptions/ExceptionAssert.cs index 35f62548c..997a9e36d 100644 --- a/src/client/spark_core/utils/Exceptions/ExceptionAssert.cs +++ b/src/client/spark_core/utils/Exceptions/ExceptionAssert.cs @@ -108,7 +108,7 @@ namespace mbts.utils { GreaterThanEqualTo(argument, value, name); } - public static void LessThan(T argument, T value, string name) where T : IComparable { + public static void LessThan(T argument, T value, [CallerArgumentExpression(nameof(argument))]string name = "") where T : IComparable { if (argument.CompareTo(value) >= 0) throw new ArgumentException($"Must be less than {value}.", name); }