Applied suggestions

This commit is contained in:
LubieKakao1212 2022-12-19 13:54:07 +00:00
parent 11cbaac33d
commit 90caf11c6c

View File

@ -5,7 +5,7 @@ namespace NEG.Utils.Collections
public static class DictionaryExtensions
{
/// <summary>
/// Adds an element to a dictionary if there was none assigned to specified <paramref name="key"/>, otherwise replaces the existing
/// Adds given value to a dictionary if there was no element at given <paramref name="key"/>, replaces element with <paramref name="value"> otherwise.
/// </summary>
/// <returns>true if element was added, false if it was replaced</returns>
public static bool AddOrUpdate<K, V>(this Dictionary<K, V> dict, K key, V value)
@ -24,9 +24,9 @@ namespace NEG.Utils.Collections
/// <summary>
/// Gets a value from the dictionary under a specified key or sets it if there was no assoiation then return the associated value
/// Gets a value from the dictionary under a specified key or adds it if did not exist and returns <paramref name="defaultValue"/>.
/// </summary>
/// <returns></returns>
/// <returns>value under a given <paramref name="key"/> if it exists, <paramref name="defaultValue"/> otherwise</returns>
public static V GetOrSetToDefault<K, V>(this Dictionary<K, V> dict, K key, V defaultValue)
{
if (dict.TryGetValue(key, out V value))