Skip to content

Commit

Permalink
*
Browse files Browse the repository at this point in the history
  • Loading branch information
ldqk committed Dec 16, 2019
1 parent f477e69 commit 57ee7e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Masuit.Tools.Core/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1280,9 +1280,14 @@ public static TValue AddOrUpdate<TKey, TValue>(this IDictionary<TKey, TValue> @t
public static TValue AddOrUpdate<TKey, TValue>(this IDictionary<TKey, TValue> @this, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
{
if (!@this.ContainsKey(key))
{
@this.Add(new KeyValuePair<TKey, TValue>(key, addValueFactory(key)));
}
else
{
@this[key] = updateValueFactory(key, @this[key]);
}

return @this[key];
}

Expand Down
5 changes: 5 additions & 0 deletions Masuit.Tools/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,9 +1278,14 @@ public static TValue AddOrUpdate<TKey, TValue>(this IDictionary<TKey, TValue> @t
public static TValue AddOrUpdate<TKey, TValue>(this IDictionary<TKey, TValue> @this, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
{
if (!@this.ContainsKey(key))
{
@this.Add(new KeyValuePair<TKey, TValue>(key, addValueFactory(key)));
}
else
{
@this[key] = updateValueFactory(key, @this[key]);
}

return @this[key];
}

Expand Down

0 comments on commit 57ee7e9

Please sign in to comment.