From 48d5c81a957e7ac00c412d471ce697566b9250eb Mon Sep 17 00:00:00 2001 From: vaipatel Date: Fri, 15 Nov 2019 13:42:38 -0500 Subject: [PATCH] Fix ArgumentOutOfRangeException's ctor param order (#45) The paramName comes before the message for the ArgumentOutOfRangeException((string, string) constructor. See https://bit.ly/2BqTDPs for details of the above ctor at netstandard1.1 --- src/GuardClauses/GuardClauseExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GuardClauses/GuardClauseExtensions.cs b/src/GuardClauses/GuardClauseExtensions.cs index f23f0425..fb9532ea 100644 --- a/src/GuardClauses/GuardClauseExtensions.cs +++ b/src/GuardClauses/GuardClauseExtensions.cs @@ -140,7 +140,7 @@ private static void OutOfRange(this IGuardClause guardClause, T input, string if (comparer.Compare(input, rangeFrom) < 0 || comparer.Compare(input, rangeTo) > 0) { - throw new ArgumentOutOfRangeException($"Input {parameterName} was out of range", parameterName); + throw new ArgumentOutOfRangeException(parameterName, $"Input {parameterName} was out of range"); } } @@ -232,7 +232,7 @@ public static void OutOfRange(this IGuardClause guardClause, int input, strin if (!Enum.IsDefined(typeof(T), input)) { string enumName = typeof(T).ToString(); - throw new ArgumentOutOfRangeException($"Required input {parameterName} was not a valid enum value for {typeof(T).ToString()}.", parameterName); + throw new ArgumentOutOfRangeException(parameterName, $"Required input {parameterName} was not a valid enum value for {typeof(T).ToString()}."); } }