相当于SoftReference在.net中? [英] Equivalent to SoftReference in .net?
问题描述
我所熟悉的的WeakReference
,但我期待为被清除的只有的当内存不足时,不能简单地每次引用类型当GC运行(就像Java的 SoftReference
)。我正在寻找一种方式来实现内存敏感的缓存。
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.
推荐答案
没有没有等效的。是否有特别的原因的WeakReference
不会做的工作?
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:
<一个href="http://stackoverflow.com/questions/324633/why-doesnt-net-have-a-softreference-as-well-as-a-weakreference-like-java">http://stackoverflow.com/questions/324633/why-doesnt-net-have-a-softreference-as-well-as-a-weakreference-like-java
这篇关于相当于SoftReference在.net中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!