Click or drag to resize

WeakDictionaryTKey, TValue Class

A generic dictionary, which allows its keys to be garbage collected if there are no other references to them than from the dictionary itself.
Inheritance Hierarchy
SystemObject
  com.espertech.esper.compatWeakDictionaryTKey, TValue

Namespace:  com.espertech.esper.compat
Assembly:  NEsper.Compat (in NEsper.Compat.dll) Version: 8.0.0.0
Syntax
C#
public sealed class WeakDictionary<TKey, TValue> : IDictionary, 
	ICollection, IEnumerable, IEnumerable
where TKey : class
where TValue : class

Type Parameters

TKey

[Missing <typeparam name="TKey"/> documentation for "T:com.espertech.esper.compat.WeakDictionary`2"]

TValue

[Missing <typeparam name="TValue"/> documentation for "T:com.espertech.esper.compat.WeakDictionary`2"]

The WeakDictionaryTKey, TValue type exposes the following members.

Constructors
  NameDescription
Public methodWeakDictionaryTKey, TValue
Initializes a new instance of the WeakDictionaryTKey, TValue class.
Public methodWeakDictionaryTKey, TValue(IEqualityComparerT)
Initializes a new instance of the WeakDictionaryTKey, TValue class
Public methodWeakDictionaryTKey, TValue(Int32)
Initializes a new instance of the WeakDictionaryTKey, TValue class.
Public methodWeakDictionaryTKey, TValue(Int32, IEqualityComparerT)
Initializes a new instance of the WeakDictionaryTKey, TValue class
Top
Properties
Methods
  NameDescription
Public methodAdd(KeyValuePairTKey, TValue)
Public methodAdd(TKey, TValue)
Public methodClear
Public methodContains
Public methodContainsKey
Public methodCopyTo
Public methodGet(TKey)
Fetches the value associated with the specified key. If no value can be found, then default(V) is returned.
Public methodGet(TKey, TValue)
Fetches the value associated with the specified key. If no value can be found, then the defaultValue is returned.
Public methodGetEnumerator
Returns an enumerator that iterates through the collection.
Public methodPush
Sets the given key in the dictionary. If the key already exists, then it is remapped to the new value. If a value was previously mapped it is returned.
Public methodPut
Sets the given key in the dictionary. If the key already exists, then it is remapped to thenew value.
Public methodPutAll
Public methodRemove(KeyValuePairTKey, TValue)
Public methodRemove(TKey)
Public methodRemove(TKey, TValue)
Removes the item from the dictionary that is associated with the specified key.
Public methodRemoveAndReturn
Removes the item from the dictionary that is associated with the specified key. The item if found is returned; if not, default(V) is returned.
Public methodRemoveCollectedEntries
Removes the left-over weak references for entries in the dictionary whose key or value has already been reclaimed by the garbage collector. This will reduce the dictionary's Count by the number of dead key-value pairs that were eliminated.
Public methodTryGetValue
Tries to get the value.
Top
Extension Methods
  NameDescription
Public Extension MethodAddAllT (Defined by CompatExtensions.)
Public Extension MethodAsHashSetT (Defined by CompatExtensions.)
Public Extension MethodAsLinkedListT (Defined by CompatExtensions.)
Public Extension MethodAsReadOnlyCollectionT (Defined by CompatExtensions.)
Public Extension MethodAsSyncCollectionT (Defined by CompatExtensions.)
Public Extension MethodAtIndex(Int32)Overloaded.
Gets the item at the nth index of the enumerable.
(Defined by CompatExtensions.)
Public Extension MethodAtIndex(Int32, FuncT, TResult)Overloaded. (Defined by CompatExtensions.)
Public Extension MethodCheckedContainsT (Defined by Collections.)
Public Extension MethodCheckedContainsKeyTK, TV (Defined by Collections.)
Public Extension MethodContainsAllT (Defined by CompatExtensions.)
Public Extension MethodDeleteK, V (Defined by DictionaryExtensions.)
Public Extension MethodEnumerateWithLookaheadT (Defined by CompatExtensions.)
Public Extension MethodFirstValueK, V (Defined by DictionaryExtensions.)
Public Extension MethodForT (Defined by CompatExtensions.)
Public Extension MethodGetK, V (Defined by DictionaryExtensions.)
Public Extension MethodHasFirstT (Defined by CompatExtensions.)
Public Extension MethodIsT, TX (Defined by CompatExtensions.)
Public Extension MethodIsEmptyT (Defined by CompatExtensions.)
Public Extension MethodIsEmptyOrNullT (Defined by CompatExtensions.)
Public Extension MethodIsNotEmptyT (Defined by CompatExtensions.)
Public Extension MethodMaterializeArrayT (Defined by CompatExtensions.)
Public Extension MethodPushK, V (Defined by DictionaryExtensions.)
Public Extension MethodPutK, V (Defined by DictionaryExtensions.)
Public Extension MethodPutAllK, V(Boolean)Overloaded. (Defined by DictionaryExtensions.)
Public Extension MethodPutAllK, V, T(Boolean, K)Overloaded. (Defined by DictionaryExtensions.)
Public Extension MethodPutIfAbsentK, V (Defined by DictionaryExtensions.)
Public Extension MethodRemoveAllT (Defined by CompatExtensions.)
Public Extension MethodRender(TextWriter)Overloaded.
Renders an enumerable source
(Defined by CompatExtensions.)
Public Extension MethodRender(FuncT, TResult)Overloaded. (Defined by CompatExtensions.)
Public Extension MethodRenderTK, TV(Void)Overloaded. (Defined by CompatExtensions.)
Public Extension MethodReverseT (Defined by CompatExtensions.)
Public Extension MethodSecondT (Defined by CompatExtensions.)
Public Extension MethodToArrayOrNullT (Defined by CompatExtensions.)
Public Extension MethodToListOrNullT (Defined by CompatExtensions.)
Public Extension MethodTryPushK, V (Defined by DictionaryExtensions.)
Public Extension MethodTryPutIfAbsentK, V (Defined by DictionaryExtensions.)
Public Extension MethodTryRemoveK, V (Defined by DictionaryExtensions.)
Top
Remarks
If the key of a particular entry in the dictionary has been collected, then both the key and value become effectively unreachable. However, left-over WeakReference objects for the key will physically remain in the dictionary until RemoveCollectedEntries is called. This will lead to a discrepancy between the Count property and the number of iterations required to visit all of the elements of the dictionary using its enumerator or those of the Keys and Values collections. Similarly, CopyTo will copy fewer than Count elements in this situation.
See Also