diff --git a/ArchiSteamFarm/Collections/ConcurrentList.cs b/ArchiSteamFarm/Collections/ConcurrentList.cs index a17439d16..d44f0b8f7 100644 --- a/ArchiSteamFarm/Collections/ConcurrentList.cs +++ b/ArchiSteamFarm/Collections/ConcurrentList.cs @@ -34,7 +34,6 @@ public sealed class ConcurrentList : IList, IReadOnlyList where T : not [PublicAPI] public event EventHandler? OnModified; - [PublicAPI] public int Count { get { using (Lock.ReaderLock()) { @@ -48,9 +47,6 @@ public sealed class ConcurrentList : IList, IReadOnlyList where T : not private readonly List BackingCollection; private readonly AsyncReaderWriterLock Lock = new(); - int ICollection.Count => Count; - int IReadOnlyCollection.Count => Count; - public T this[int index] { get { using (Lock.ReaderLock()) { diff --git a/ArchiSteamFarm/Collections/ObservableConcurrentDictionary.cs b/ArchiSteamFarm/Collections/ObservableConcurrentDictionary.cs index 41399e043..4c2038f7a 100644 --- a/ArchiSteamFarm/Collections/ObservableConcurrentDictionary.cs +++ b/ArchiSteamFarm/Collections/ObservableConcurrentDictionary.cs @@ -35,7 +35,6 @@ public sealed class ObservableConcurrentDictionary : IDictionary BackingDictionary.Count; [PublicAPI] @@ -43,17 +42,13 @@ public sealed class ObservableConcurrentDictionary : IDictionary false; - [PublicAPI] public ICollection Keys => BackingDictionary.Keys; + public ICollection Values => BackingDictionary.Values; private readonly ConcurrentDictionary BackingDictionary; - int ICollection>.Count => BackingDictionary.Count; - int IReadOnlyCollection>.Count => BackingDictionary.Count; IEnumerable IReadOnlyDictionary.Keys => BackingDictionary.Keys; - ICollection IDictionary.Keys => BackingDictionary.Keys; IEnumerable IReadOnlyDictionary.Values => BackingDictionary.Values; - ICollection IDictionary.Values => BackingDictionary.Values; public TValue this[TKey key] { get => BackingDictionary[key]; @@ -107,7 +102,7 @@ public sealed class ObservableConcurrentDictionary : IDictionary : IDictionary item) => ((ICollection>) BackingDictionary).Contains(item); + public bool ContainsKey(TKey key) { + ArgumentNullException.ThrowIfNull(key); + + return BackingDictionary.ContainsKey(key); + } + public void CopyTo(KeyValuePair[] array, int arrayIndex) { ArgumentNullException.ThrowIfNull(array); ArgumentOutOfRangeException.ThrowIfNegative(arrayIndex); @@ -151,33 +152,15 @@ public sealed class ObservableConcurrentDictionary : IDictionary.ContainsKey(TKey key) { + public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) { ArgumentNullException.ThrowIfNull(key); - return BackingDictionary.ContainsKey(key); - } - - bool IReadOnlyDictionary.ContainsKey(TKey key) { - ArgumentNullException.ThrowIfNull(key); - - return BackingDictionary.ContainsKey(key); + return BackingDictionary.TryGetValue(key, out value); } [MustDisposeResource] IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - bool IReadOnlyDictionary.TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) { - ArgumentNullException.ThrowIfNull(key); - - return BackingDictionary.TryGetValue(key, out value); - } - - bool IDictionary.TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) { - ArgumentNullException.ThrowIfNull(key); - - return BackingDictionary.TryGetValue(key, out value); - } - [PublicAPI] public bool TryAdd(TKey key, TValue value) { ArgumentNullException.ThrowIfNull(key); @@ -190,11 +173,4 @@ public sealed class ObservableConcurrentDictionary : IDictionary