ikvm
ikvm copied to clipboard
Task: Convert usage from PassiveWeakDictionary<TKey, TValue> to ConditionalWeakTable<TKey, TValue>
In .NET 4.0+ there is now a ConditionalWeakTable<TKey, TValue>
class that ties directly into the GC in native code, which can be used as a direct replacement for PassiveWeakDictionary<TKey, TValue>
.
It should be possible to use this as a drop-in replacement as it has the same constraints, same key comparison, and same APIs, except for it is lacking a Dispose()
method and instead relies on a finalizer to clean up unmanaged resources.
It looks safe to replace to me. It's used to associate TypeWrappers with ghost objects. No unmanaged resources involved.