Skip to content

Commit

Permalink
Fix ArgumentOutOfRangeException's ctor param order (#45)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vaipatel authored and ardalis committed Nov 15, 2019
1 parent 041f78d commit 48d5c81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GuardClauses/GuardClauseExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private static void OutOfRange<T>(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");
}
}

Expand Down Expand Up @@ -232,7 +232,7 @@ public static void OutOfRange<T>(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()}.");
}
}

Expand Down

0 comments on commit 48d5c81

Please sign in to comment.