IndexOutOfRangeException was thrown in some cases when executing ObservableHashSet.AddRange.
static IEnumerable<int> Range(int count)
{
foreach (var i in Enumerable.Range(0, count))
{
yield return i;
}
}
var set = new ObservableHashSet<int>();
set.AddRange(Range(20));
The reason is that when ResizableArray<T>.EnsureCapacity is executed, the capacity of the new array equals the capacity of the old array.
Therefore, I modified it to create a new array with twice the capacity of the old one.
IndexOutOfRangeException was thrown in some cases when executing
ObservableHashSet.AddRange
.The reason is that when
ResizableArray<T>.EnsureCapacity
is executed, the capacity of the new array equals the capacity of the old array. Therefore, I modified it to create a new array with twice the capacity of the old one.