Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Stephen Toub <[email protected]>
  • Loading branch information
hrrrrustic and stephentoub authored Nov 11, 2022
commit 91e279e744eb587f7277f7616f2f3d0ce2dfbfcc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static void ThrowIfNegativeOrZero<T>(T value, [CallerArgumentExpression(n
public static void ThrowIfGreaterThan<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null)
where T : IComparable<T>
{
if (value.CompareTo(other) == 1)
if (value.CompareTo(other) > 0)
Throw(paramName, SR.Format(SR.ArgumentOutOfRange_Generic_MustBeLowerOrEqual, paramName, other));
}

Expand All @@ -143,7 +143,7 @@ public static void ThrowIfGreaterThan<T>(T value, T other, [CallerArgumentExpres
public static void ThrowIfGreaterThanOrEqual<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null)
where T : IComparable<T>
{
if (value.CompareTo(other) != -1)
if (value.CompareTo(other) >= 0)
Throw(paramName, SR.Format(SR.ArgumentOutOfRange_Generic_MustBeLower, paramName, other));
}

Expand All @@ -154,7 +154,7 @@ public static void ThrowIfGreaterThanOrEqual<T>(T value, T other, [CallerArgumen
public static void ThrowIfLessThan<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null)
where T : IComparable<T>
{
if (value.CompareTo(other) == -1)
if (value.CompareTo(other) < 0)
Throw(paramName, SR.Format(SR.ArgumentOutOfRange_Generic_MustBeGreaterOrEqual, paramName, other));
}

Expand All @@ -165,7 +165,7 @@ public static void ThrowIfLessThan<T>(T value, T other, [CallerArgumentExpressio
public static void ThrowIfLessThanOrEqual<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null)
where T : IComparable<T>
{
if (value.CompareTo(other) != 1)
if (value.CompareTo(other) <= 0)
Throw(paramName, SR.Format(SR.ArgumentOutOfRange_Generic_MustBeGreater, paramName, other));
}
}
Expand Down