Skip to content

Commit bdf7ca1

Browse files
authored
Update ConcurrentSet.cs
1 parent 4587ead commit bdf7ca1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/WeihanLi.Common/Helpers/ConcurrentSet.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ namespace WeihanLi.Common.Helpers;
55

66
public sealed class ConcurrentSet<T> : IReadOnlyCollection<T>, ICollection<T> where T : notnull
77
{
8-
private readonly ConcurrentDictionary<T, object?> _dictionary = new();
8+
// https://github.com/dotnet/runtime/issues/39919#issuecomment-954774092
9+
private readonly ConcurrentDictionary<T, byte> _dictionary = new();
910

1011
public bool IsEmpty => _dictionary.IsEmpty;
1112

@@ -15,7 +16,7 @@ public sealed class ConcurrentSet<T> : IReadOnlyCollection<T>, ICollection<T> wh
1516

1617
public bool Contains(T item) => _dictionary.ContainsKey(item);
1718

18-
public bool TryAdd(T t) => _dictionary.TryAdd(t, null);
19+
public bool TryAdd(T t) => _dictionary.TryAdd(t, default);
1920

2021
public bool TryRemove(T t) => _dictionary.TryRemove(t, out _);
2122

0 commit comments

Comments
 (0)