diff --git a/src/Avalonia.Base/Collections/AvaloniaList.cs b/src/Avalonia.Base/Collections/AvaloniaList.cs
index 5681214222..2c7f34c5be 100644
--- a/src/Avalonia.Base/Collections/AvaloniaList.cs
+++ b/src/Avalonia.Base/Collections/AvaloniaList.cs
@@ -454,6 +454,28 @@ namespace Avalonia.Collections
}
}
+ ///
+ /// Ensures that the capacity of the list is at least .
+ ///
+ /// The capacity.
+ public void EnsureCapacity(int capacity)
+ {
+ // Adapted from List implementation.
+ var currentCapacity = _inner.Capacity;
+
+ if (currentCapacity < capacity)
+ {
+ var newCapacity = currentCapacity == 0 ? 4 : currentCapacity * 2;
+
+ if (newCapacity < capacity)
+ {
+ newCapacity = capacity;
+ }
+
+ _inner.Capacity = newCapacity;
+ }
+ }
+
///
/// Removes an item from the collection.
///
@@ -633,24 +655,6 @@ namespace Avalonia.Collections
///
Delegate[] INotifyCollectionChangedDebug.GetCollectionChangedSubscribers() => _collectionChanged?.GetInvocationList();
- private void EnsureCapacity(int capacity)
- {
- // Adapted from List implementation.
- var currentCapacity = _inner.Capacity;
-
- if (currentCapacity < capacity)
- {
- var newCapacity = currentCapacity == 0 ? 4 : currentCapacity * 2;
-
- if (newCapacity < capacity)
- {
- newCapacity = capacity;
- }
-
- _inner.Capacity = newCapacity;
- }
- }
-
///
/// Raises the event with an add action.
///