Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Properties | Public Member Functions | Protected Member Functions | List of all members
Loyc.Collections.WeakValueDictionary< K, V > Class Template Reference

A dictionary in which the values are weak. When a value has been garbage- collected, the dictionary acts as if the key is not present (except the Remove() method, which saves time by not checking whether the value is dead.) More...


Source file:
Inheritance diagram for Loyc.Collections.WeakValueDictionary< K, V >:

Remarks

A dictionary in which the values are weak. When a value has been garbage- collected, the dictionary acts as if the key is not present (except the Remove() method, which saves time by not checking whether the value is dead.)

This is implemented on top of a standard Dictionary. In order to allow the dictionary to be read safely while it is being enumerated, cleanup operations (to remove entries whose value has been garbage-collected) do not occur automatically during read operations. You can allow cleanups by calling AutoCleanup().

Type Constraints
V :class 

Properties

override int Count [get]
 Returns the number of dictionary entries. This value may be greater than the number of elements that are still alive. More...
 

Public Member Functions

bool AutoCleanup ()
 Periodically removes entries with garbage-collected values from the dictionary More...
 
void Cleanup ()
 Removes entries with garbage-collected values from the dictionary. More...
 
override void Clear ()
 
override void Add (K key, V value)
 
override bool ContainsKey (K key)
 
override bool Remove (K key)
 
override bool TryGetValue (K key, out V value)
 
override IEnumerator
< KeyValuePair< K, V > > 
GetEnumerator ()
 

Protected Member Functions

override void SetValue (K key, V value)
 

Member Function Documentation

bool Loyc.Collections.WeakValueDictionary< K, V >.AutoCleanup ( )
inline

Periodically removes entries with garbage-collected values from the dictionary

void Loyc.Collections.WeakValueDictionary< K, V >.Cleanup ( )
inline

Removes entries with garbage-collected values from the dictionary.

Property Documentation

override int Loyc.Collections.WeakValueDictionary< K, V >.Count
get

Returns the number of dictionary entries. This value may be greater than the number of elements that are still alive.