diff --git a/ArchiSteamFarm/ConcurrentHashSet.cs b/ArchiSteamFarm/ConcurrentHashSet.cs index dfa320354..9f1bd39a7 100644 --- a/ArchiSteamFarm/ConcurrentHashSet.cs +++ b/ArchiSteamFarm/ConcurrentHashSet.cs @@ -34,9 +34,20 @@ namespace ArchiSteamFarm { private readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); public bool IsReadOnly => false; - public IEnumerator GetEnumerator() => new ConcurrentEnumerator(HashSet, Lock); + public int Count { + get { + Lock.EnterReadLock(); + + try { + return HashSet.Count; + } finally { + Lock.ExitReadLock(); + } + } + } + [SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")] public bool Add(T item) { Lock.EnterWriteLock(); @@ -89,18 +100,6 @@ namespace ArchiSteamFarm { } } - public int Count { - get { - Lock.EnterReadLock(); - - try { - return HashSet.Count; - } finally { - Lock.ExitReadLock(); - } - } - } - public void Dispose() { if (Lock != null) { Lock.Dispose(); @@ -121,4 +120,4 @@ namespace ArchiSteamFarm { IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } -} \ No newline at end of file +}