Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obsolete AddOrSet #7408

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5642,6 +5642,7 @@ namespace Akka.Util.Internal
public class static Extensions
{
public static System.Collections.Generic.IDictionary<TKey, TValue> AddAndReturn<TKey, TValue>(this System.Collections.Generic.IDictionary<TKey, TValue> hash, TKey key, TValue value) { }
[System.ObsoleteAttribute("Use the dictionary setter directly")]
public static void AddOrSet<TKey, TValue>(this System.Collections.Generic.IDictionary<TKey, TValue> hash, TKey key, TValue value) { }
public static T AsInstanceOf<T>(this object self) { }
public static string BetweenDoubleQuotes(this string self) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5631,6 +5631,7 @@ namespace Akka.Util.Internal
public class static Extensions
{
public static System.Collections.Generic.IDictionary<TKey, TValue> AddAndReturn<TKey, TValue>(this System.Collections.Generic.IDictionary<TKey, TValue> hash, TKey key, TValue value) { }
[System.ObsoleteAttribute("Use the dictionary setter directly")]
public static void AddOrSet<TKey, TValue>(this System.Collections.Generic.IDictionary<TKey, TValue> hash, TKey key, TValue value) { }
public static T AsInstanceOf<T>(this object self) { }
public static string BetweenDoubleQuotes(this string self) { }
Expand Down
8 changes: 3 additions & 5 deletions src/core/Akka/Util/Internal/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,10 @@ public static string BetweenDoubleQuotes(this string self)
/// <param name="hash">TBD</param>
/// <param name="key">TBD</param>
/// <param name="value">TBD</param>
[Obsolete("Use the dictionary setter directly")]
public static void AddOrSet<TKey, TValue>(this IDictionary<TKey, TValue> hash, TKey key, TValue value)
{
if (hash.ContainsKey(key))
hash[key] = value;
else
hash.Add(key,value);
hash[key] = value;
}

/// <summary>
Expand Down Expand Up @@ -146,7 +144,7 @@ public static TValue GetOrElse<TKey, TValue>(this IDictionary<TKey, TValue> hash
/// <returns>TBD</returns>
public static IDictionary<TKey, TValue> AddAndReturn<TKey, TValue>(this IDictionary<TKey, TValue> hash, TKey key, TValue value)
{
hash.AddOrSet(key, value);
hash[key] = value;
return hash;
}

Expand Down
Loading