mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
dev: Added argumentoutofrange static methods, no functional change
This commit is contained in:
@@ -46,12 +46,8 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ICollection<T
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(array);
|
||||
|
||||
if (arrayIndex < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
|
||||
|
||||
if (arrayIndex >= array.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
|
||||
ArgumentOutOfRangeException.ThrowIfNegative(arrayIndex);
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(arrayIndex, array.Length);
|
||||
|
||||
CopyToInternal(array, arrayIndex);
|
||||
}
|
||||
|
@@ -38,8 +38,8 @@ public sealed class NadekoRandom : Random
|
||||
|
||||
public long NextLong(long minValue, long maxValue)
|
||||
{
|
||||
if (minValue > maxValue)
|
||||
throw new ArgumentOutOfRangeException(nameof(maxValue));
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThan(minValue, maxValue);
|
||||
|
||||
if (minValue == maxValue)
|
||||
return minValue;
|
||||
var bytes = new byte[sizeof(long)];
|
||||
|
@@ -9,8 +9,7 @@ public sealed class QueueRunner
|
||||
|
||||
public QueueRunner(int delayMs = 0, int maxCapacity = -1)
|
||||
{
|
||||
if (delayMs < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(delayMs));
|
||||
ArgumentOutOfRangeException.ThrowIfNegative(delayMs);
|
||||
|
||||
_delayMs = delayMs;
|
||||
_channel = maxCapacity switch
|
||||
|
@@ -9,8 +9,7 @@ public sealed class RatelimitAttribute : PreconditionAttribute
|
||||
|
||||
public RatelimitAttribute(int seconds)
|
||||
{
|
||||
if (seconds <= 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(seconds));
|
||||
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(seconds);
|
||||
|
||||
Seconds = seconds;
|
||||
}
|
||||
|
Reference in New Issue
Block a user