Class WeakKeyConcurrentDictionary<TKey, TValue>
Concurrent dictionary which uses weak references for key values. This way you may add mapping without care key referenced object will never be released. You need eventually call Cleanup() to ensure entries with dead references removed.
Inheritance
System.Object
WeakKeyConcurrentDictionary<TKey, TValue>
Implements
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>
System.Collections.IEnumerable
Namespace: Eco.Core.Utils
Assembly: Eco.Core.dll
Syntax
public class WeakKeyConcurrentDictionary<TKey, TValue> : Object, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable where TKey : class
Type Parameters
Name | Description |
---|---|
TKey | |
TValue |
Constructors
WeakKeyConcurrentDictionary()
Declaration
public WeakKeyConcurrentDictionary()
Properties
Item[TKey]
Declaration
public TValue this[TKey key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
TKey | key |
Property Value
Type | Description |
---|---|
TValue |
Methods
Cleanup()
Removes all "dead" key entries.
Declaration
public void Cleanup()
Clear()
Removes all entries no matter if alive or not.
Declaration
public void Clear()
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> |
TryGetValue(TKey, out TValue)
Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | |
TValue | value |
Returns
Type | Description |
---|---|
System.Boolean |
TryRemove(TKey, out TValue)
Declaration
public bool TryRemove(TKey key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | |
TValue | value |
Returns
Type | Description |
---|---|
System.Boolean |
Implements
System.Collections.Generic.IEnumerable<>
System.Collections.IEnumerable