[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

A generic dictionary, which allows its keys to be garbage collected if there are no other references to them than from the dictionary itself.

Namespace: net.esper.compat
Assembly:   NEsper (in NEsper.dll)

Syntax

Visual Basic (Declaration)
<DefaultMemberAttribute("Item")> _
Public NotInheritable Class WeakDictionary(Of TKey As Class, TValue As Class) _
	Implements IDictionary(Of TKey, TValue), ICollection(Of KeyValuePair(Of TKey, TValue)), IEnumerable(Of KeyValuePair(Of TKey, TValue)), IEnumerable
C#
[DefaultMemberAttribute("Item")]
public sealed class WeakDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable where TKey : class where TValue : class
Visual C++
[DefaultMemberAttribute(L"Item")]
generic<typename TKey, typename TValue>
where TKey : ref class
where TValue : ref class
public ref class WeakDictionary sealed : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable

Type Parameters

TKey
TValue

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.

Inheritance Hierarchy

System.Object
  net.esper.compat.WeakDictionary<(Of TKey, TValue>)