Version

Compact Method (WeakDictionary<TKey,TValue>)

Removes entries from the dictionary where keys are no longer alive (have been garbage collected). Note that keys can get garbage collected during the process of compacting and therefore it's not guarrenteed that all the entries in the dictionary will be with live keys after this operation is completed.
Syntax
'Declaration
 
Public Sub Compact( _
   ByVal removeEntriesWithNullValues As Boolean _
) 
public void Compact( 
   bool removeEntriesWithNullValues
)

Parameters

removeEntriesWithNullValues
Whether to also remove entries where value is null or has been garbage collected.
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also