Skip to content

Commit

Permalink
Simpler index check
Browse files Browse the repository at this point in the history
  • Loading branch information
ds5678 committed Oct 5, 2024
1 parent 2ac6a43 commit c76252d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private protected static bool ThrowImmutableLength()

private protected void ThrowIfIndexOutOfRange(int index)
{
if (index < 0 || index >= Length)
if ((uint)index >= (uint)Length)
throw new ArgumentOutOfRangeException(nameof(index),
"Array index may not be negative or above length of the array");
}
Expand Down

0 comments on commit c76252d

Please sign in to comment.