1
0
mirror of https://github.com/chylex/.NET-Community-Toolkit.git synced 2025-04-10 11:15:45 +02:00

Added IDictionarySlim interface

This commit is contained in:
Sergio Pedri 2020-06-24 17:24:18 +02:00
parent 98a706bbf5
commit c652ca247b
2 changed files with 23 additions and 11 deletions
Microsoft.Toolkit.Mvvm/Messaging/Microsoft.Collections.Extensions

View File

@ -0,0 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.Collections.Extensions
{
/// <summary>
/// A base interface masking <see cref="DictionarySlim{TKey,TValue}"/> instances and exposing non-generic functionalities.
/// </summary>
internal interface IDictionarySlim
{
/// <summary>
/// Gets the count of entries in the dictionary.
/// </summary>
int Count { get; }
/// <summary>
/// Clears the current dictionary.
/// </summary>
void Clear();
}
}

View File

@ -10,14 +10,9 @@ namespace Microsoft.Collections.Extensions
/// An interface providing key type contravariant access to a <see cref="DictionarySlim{TKey,TValue}"/> instance.
/// </summary>
/// <typeparam name="TKey">The contravariant type of keys in the dictionary.</typeparam>
internal interface IDictionarySlim<in TKey>
internal interface IDictionarySlim<in TKey> : IDictionarySlim
where TKey : IEquatable<TKey>
{
/// <summary>
/// Gets the count of entries in the dictionary.
/// </summary>
int Count { get; }
/// <summary>
/// Tries to remove a value with a specified key.
/// </summary>
@ -32,10 +27,5 @@ internal interface IDictionarySlim<in TKey>
/// <param name="key">The key of the item to remove.</param>
/// <returns>Whether or not an item was removed.</returns>
bool Remove(TKey key);
/// <summary>
/// Clears the current dictionary.
/// </summary>
void Clear();
}
}