Merge pull request #43 from prozolic/pullreq

fix CloneCollection
This commit is contained in:
Yoshifumi Kawai 2024-06-10 14:50:01 +09:00 committed by GitHub
commit 232955ecac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,8 +74,10 @@ namespace ObservableCollections.Internal
{
if (array.Length == index)
{
var newArray = ArrayPool<T>.Shared.Rent(index * 2);
Array.Copy(array, newArray, index);
ArrayPool<T>.Shared.Return(array, RuntimeHelpersEx.IsReferenceOrContainsReferences<T>());
array = ArrayPool<T>.Shared.Rent(index * 2);
array = newArray;
}
}