var table = new ConditionalWeakTable
DictionaryIn contrast to Example 1, this example uses a standard dictionary to store a key-value pair. However, once the object is set to null and garbage collected, the dictionary still holds a reference to the object, preventing it from being fully garbage collected. The ConditionalWeakTable class is part of the .NET Framework Class Library. No separate package or library needs to be installed to use this class.