Browse Source

Added Clear method.

pull/8571/head
Steven Kirk 4 years ago
parent
commit
102302999c
  1. 16
      src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs

16
src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs

@ -103,6 +103,22 @@ namespace Avalonia.Utilities
ThrowDuplicate(); ThrowDuplicate();
InsertEntry(new Entry(property, value), index); InsertEntry(new Entry(property, value), index);
} }
/// <summary>
/// Removes all keys and values from the collection.
/// </summary>
/// <remarks>
/// The Count property is set to 0, and references to other objects from elements of the
/// collection are also released. The capacity remains unchanged.
/// </remarks>
public void Clear()
{
if (_entries is not null)
{
Array.Clear(_entries, 0, _entries.Length);
_entryCount = 0;
}
}
/// <summary> /// <summary>
/// Determines whether the collection contains the specified key. /// Determines whether the collection contains the specified key.

Loading…
Cancel
Save