public void RemoveRange(int offset, int count) { Deque <T> .CheckRangeArguments(Count, offset, count); if (count == 0) { return; } DoRemoveRange(offset, count); }
void ICollection <T> .CopyTo(T[] array, int arrayIndex) { if (array == null) { throw new ArgumentNullException(nameof(array), "Array is null"); } var count = Count; Deque <T> .CheckRangeArguments(array.Length, arrayIndex, count); for (var index = 0; index != count; ++index) { array[arrayIndex + index] = this[index]; } }
void ICollection.CopyTo(Array array, int index) { if (array == null) { throw new ArgumentNullException(nameof(array), "Destination array cannot be null."); } Deque <T> .CheckRangeArguments(array.Length, index, Count); for (var index1 = 0; index1 != Count; ++index1) { try { array.SetValue(this[index1], index + index1); } catch (InvalidCastException ex) { throw new ArgumentException("Destination array is of incorrect type.", ex); } } }