#### [Abblix\.Utils](https://www.abblix.com/en/docs/api/abblix-utils 'index')
### [Abblix\.Utils\.Collections](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections 'Abblix\.Utils\.Collections')

## ConcurrentSet\<T\> Class

A set that several threads may add to and enumerate at the same time, losing neither what is already stored
nor what is being added\.

```csharp
public sealed class ConcurrentSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
    where T : notnull
```
#### Type parameters

###### `T` {#Abblix.Utils.Collections.ConcurrentSet_T_.T}

The element type\. Uses the type's default equality comparer\.

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → ConcurrentSet\<T\>

Implements [System\.Collections\.Generic\.ICollection&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')[T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1'), [System\.Collections\.Generic\.IEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')[T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1'), [System\.Collections\.IEnumerable](https://learn.microsoft.com/en-us/dotnet/api/system.collections.ienumerable 'System\.Collections\.IEnumerable')

### Remarks
The \.NET base class library ships no concurrent set, so the choice is between a [System\.Collections\.Generic\.HashSet&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.hashset-1 'System\.Collections\.Generic\.HashSet\`1')
under a lock and the keys of a [System\.Collections\.Concurrent\.ConcurrentDictionary&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.concurrent.concurrentdictionary-2 'System\.Collections\.Concurrent\.ConcurrentDictionary\`2'), which are exactly a
concurrent set with a value nobody reads\. The dictionary wins on two counts\.

Its `TryAdd` is an atomic test\-and\-add that also reports which caller performed the addition\. That is
the operation the defect needed: `if (!Contains) Add` is two operations with a window between them, and
a lock closes the window only for as long as every caller remembers to take it, whereas here the guarantee
belongs to the type\.

And its `Keys` property is documented to return "a copy of all the keys", not "kept in sync" with the
dictionary\. That promise is what makes this usable from an `async` loop: a reader holding a lock cannot
`await` inside the loop, so any lock\-based set would force the caller to copy first \- and a copy is
what this returns to begin with\. A reader iterating while a writer adds therefore neither throws
[System\.InvalidOperationException](https://learn.microsoft.com/en-us/dotnet/api/system.invalidoperationexception 'System\.InvalidOperationException') nor loses an element that was already there\.

The alternative considered was an `ImmutableHashSet` field updated by
[System\.Threading\.Interlocked\.CompareExchange&lt;&gt;\(@@0@,@@0,@@0\)](https://learn.microsoft.com/en-us/dotnet/api/system.threading.interlocked.compareexchange--1#system-threading-interlocked-compareexchange--1(--0@---0---0) 'System\.Threading\.Interlocked\.CompareExchange\`\`1\(\`\`0@,\`\`0,\`\`0\)'): correct, and lock\-free, but it
allocates a new version of the set per addition and spins a retry loop under contention, for no gain over
this\. The cost of what is here instead is a placeholder byte per element and a [Count](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.Count 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.Count') that
takes every segment lock \- both irrelevant at the sizes this holds\.
### Constructors

## ConcurrentSet\(\) Constructor {#Abblix.Utils.Collections.ConcurrentSet_T_.ConcurrentSet()}

Creates an empty set\.

```csharp
public ConcurrentSet();
```

## ConcurrentSet\(IEnumerable\<T\>\) Constructor {#Abblix.Utils.Collections.ConcurrentSet_T_.ConcurrentSet(System.Collections.Generic.IEnumerable_T_)}

Creates a set containing the distinct elements of [items](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.ConcurrentSet(System.Collections.Generic.IEnumerable_T_).items 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.ConcurrentSet\(System\.Collections\.Generic\.IEnumerable\<T\>\)\.items')\.

```csharp
public ConcurrentSet(System.Collections.Generic.IEnumerable<T> items);
```
#### Parameters

###### `items` [System\.Collections\.Generic\.IEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')[T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1') {#Abblix.Utils.Collections.ConcurrentSet_T_.ConcurrentSet(System.Collections.Generic.IEnumerable_T_).items}
### Properties

## ConcurrentSet\<T\>\.Count Property {#Abblix.Utils.Collections.ConcurrentSet_T_.Count}

Gets the number of elements contained in the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\.

```csharp
public int Count { get; }
```

Implements [Count](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1.count 'System\.Collections\.Generic\.ICollection\`1\.Count')

#### Property Value
[System\.Int32](https://learn.microsoft.com/en-us/dotnet/api/system.int32 'System\.Int32')

## ConcurrentSet\<T\>\.IsReadOnly Property {#Abblix.Utils.Collections.ConcurrentSet_T_.IsReadOnly}

Gets a value indicating whether the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1') is read\-only\.

```csharp
public bool IsReadOnly { get; }
```

Implements [IsReadOnly](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1.isreadonly 'System\.Collections\.Generic\.ICollection\`1\.IsReadOnly')

#### Property Value
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')
### Methods

## ConcurrentSet\<T\>\.Add\(T\) Method {#Abblix.Utils.Collections.ConcurrentSet_T_.Add(T)}

Adds an item to the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\.

```csharp
public void Add(T item);
```
#### Parameters

###### `item` [T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T') {#Abblix.Utils.Collections.ConcurrentSet_T_.Add(T).item}

The object to add to the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\.

Implements [Add\(T\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1.add#system-collections-generic-icollection-1-add(-0) 'System\.Collections\.Generic\.ICollection\`1\.Add\(\`0\)')

#### Exceptions

[System\.NotSupportedException](https://learn.microsoft.com/en-us/dotnet/api/system.notsupportedexception 'System\.NotSupportedException')  
The [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1') is read\-only\.

## ConcurrentSet\<T\>\.Clear\(\) Method {#Abblix.Utils.Collections.ConcurrentSet_T_.Clear()}

Removes all items from the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\.

```csharp
public void Clear();
```

Implements [Clear\(\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1.clear 'System\.Collections\.Generic\.ICollection\`1\.Clear')

#### Exceptions

[System\.NotSupportedException](https://learn.microsoft.com/en-us/dotnet/api/system.notsupportedexception 'System\.NotSupportedException')  
The [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1') is read\-only\.

## ConcurrentSet\<T\>\.Contains\(T\) Method {#Abblix.Utils.Collections.ConcurrentSet_T_.Contains(T)}

Determines whether the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1') contains a specific value\.

```csharp
public bool Contains(T item);
```
#### Parameters

###### `item` [T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T') {#Abblix.Utils.Collections.ConcurrentSet_T_.Contains(T).item}

The object to locate in the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\.

Implements [Contains\(T\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1.contains#system-collections-generic-icollection-1-contains(-0) 'System\.Collections\.Generic\.ICollection\`1\.Contains\(\`0\)')

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')  
[true](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool') if [item](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.Contains(T).item 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.Contains\(T\)\.item') is found in the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1'); otherwise, [false](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool')\.

## ConcurrentSet\<T\>\.CopyTo\(T\[\], int\) Method {#Abblix.Utils.Collections.ConcurrentSet_T_.CopyTo(T[],int)}

Copies the elements of the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1') to an [System\.Array](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array'), starting at a particular [System\.Array](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') index\.

```csharp
public void CopyTo(T[] array, int arrayIndex);
```
#### Parameters

###### `array` [T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') {#Abblix.Utils.Collections.ConcurrentSet_T_.CopyTo(T[],int).array}

The one\-dimensional [System\.Array](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') that is the destination of the elements copied from [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\. The [System\.Array](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') must have zero\-based indexing\.

###### `arrayIndex` [System\.Int32](https://learn.microsoft.com/en-us/dotnet/api/system.int32 'System\.Int32') {#Abblix.Utils.Collections.ConcurrentSet_T_.CopyTo(T[],int).arrayIndex}

The zero\-based index in [array](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.CopyTo(T[],int).array 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.CopyTo\(T\[\], int\)\.array') at which copying begins\.

Implements [CopyTo\(T\[\], int\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1.copyto#system-collections-generic-icollection-1-copyto(-0[]-system-int32) 'System\.Collections\.Generic\.ICollection\`1\.CopyTo\(\`0\[\],System\.Int32\)')

#### Exceptions

[System\.ArgumentNullException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentnullexception 'System\.ArgumentNullException')  
[array](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.CopyTo(T[],int).array 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.CopyTo\(T\[\], int\)\.array') is [null](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/null 'https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/null')\.

[System\.ArgumentOutOfRangeException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception 'System\.ArgumentOutOfRangeException')  
[arrayIndex](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.CopyTo(T[],int).arrayIndex 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.CopyTo\(T\[\], int\)\.arrayIndex') is less than 0\.

[System\.ArgumentException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception 'System\.ArgumentException')  
The number of elements in the source [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1') is greater than the available space from [arrayIndex](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.CopyTo(T[],int).arrayIndex 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.CopyTo\(T\[\], int\)\.arrayIndex') to the end of the destination [array](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.CopyTo(T[],int).array 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.CopyTo\(T\[\], int\)\.array')\.

## ConcurrentSet\<T\>\.GetEnumerator\(\) Method {#Abblix.Utils.Collections.ConcurrentSet_T_.GetEnumerator()}

Enumerates a snapshot taken when enumeration begins, so what a reader sees does not depend on what a
writer does while it reads\.

```csharp
public System.Collections.Generic.IEnumerator<T> GetEnumerator();
```

Implements [GetEnumerator\(\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1.getenumerator 'System\.Collections\.Generic\.IEnumerable\`1\.GetEnumerator'), [GetEnumerator\(\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.ienumerable.getenumerator 'System\.Collections\.IEnumerable\.GetEnumerator')

#### Returns
[System\.Collections\.Generic\.IEnumerator&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerator-1 'System\.Collections\.Generic\.IEnumerator\`1')[T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerator-1 'System\.Collections\.Generic\.IEnumerator\`1')

### Remarks
Goes through `Keys` deliberately, and not through the dictionary's own enumerator: the latter is
documented as "safe to use concurrently with reads and writes \.\.\. however it does not represent a
moment\-in\-time snapshot", so it would show some later additions and not others depending on timing\.
Neither form can throw, so this is not about safety \- it is about a caller that enumerates across
`await` points getting a defined answer rather than a race\-dependent one\. Do not "simplify" this to
the dictionary's enumerator to save the copy\.

## ConcurrentSet\<T\>\.Remove\(T\) Method {#Abblix.Utils.Collections.ConcurrentSet_T_.Remove(T)}

Removes the first occurrence of a specific object from the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\.

```csharp
public bool Remove(T item);
```
#### Parameters

###### `item` [T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T') {#Abblix.Utils.Collections.ConcurrentSet_T_.Remove(T).item}

The object to remove from the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\.

Implements [Remove\(T\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1.remove#system-collections-generic-icollection-1-remove(-0) 'System\.Collections\.Generic\.ICollection\`1\.Remove\(\`0\)')

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')  
[true](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool') if [item](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.Remove(T).item 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.Remove\(T\)\.item') was successfully removed from the [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1'); otherwise, [false](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool')\. This method also returns [false](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool 'https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool') if [item](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.Remove(T).item 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.Remove\(T\)\.item') is not found in the original [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1')\.

#### Exceptions

[System\.NotSupportedException](https://learn.microsoft.com/en-us/dotnet/api/system.notsupportedexception 'System\.NotSupportedException')  
The [System\.Collections\.Generic\.ICollection&lt;&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1 'System\.Collections\.Generic\.ICollection\`1') is read\-only\.

## ConcurrentSet\<T\>\.TryAdd\(T\) Method {#Abblix.Utils.Collections.ConcurrentSet_T_.TryAdd(T)}

Adds an item if it is not already present\. Returns whether this call is the one that added it, which
lets a caller act on the transition \(persist, notify\) exactly once even under concurrency \- something
[System\.Collections\.Generic\.ICollection&lt;&gt;\.Add\(@0\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1.add#system-collections-generic-icollection-1-add(-0) 'System\.Collections\.Generic\.ICollection\`1\.Add\(\`0\)') cannot express, since it returns nothing\.

```csharp
public bool TryAdd(T item);
```
#### Parameters

###### `item` [T](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Collections.ConcurrentSet_T_#Abblix.Utils.Collections.ConcurrentSet_T_.T 'Abblix\.Utils\.Collections\.ConcurrentSet\<T\>\.T') {#Abblix.Utils.Collections.ConcurrentSet_T_.TryAdd(T).item}

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')
