I am familiar with WeakReference
, but I am looking for a reference type that is cleared only when memory is low, not simply every time when the gc runs (just like Java's SoftReference
). I'm looking for a way to implement a memory-sensitive cache.
No there isn't an equivalent. Is there a particular reason why WeakReference
won't do the job?
Here is a similar question to yours:
Why doesn't .NET have a SoftReference as well as a WeakReference, like Java?