From 2fb67bdb55dd17c0fa23bf1ce056c5fa80676d21 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 822210896..6bbb6f7f3 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); }