[SuppressMessage("Microsoft.Usage","CA1806:DoNotIgnoreMethodResults",Justification="LostKeyFinder's purpose is to get garbage collected as soon as posible")]
publicTValuethis[TKeykey]
{
get{
lock(_internalObject){
return_internalDictionary[newWeakKey(key)];
}
}
set
{
WeakKeyTkey=newWeakKey(key);
lock(_internalObject)
{
//_internalDictionary[Tkey] = value;
_internalDictionary.Add(Tkey,value);
}
// This looks a bit weird but the purpose of the lost key finder is to execute
// code in some future garbage collection phase so we immediately create some garbage.
[SuppressMessage("Microsoft.Usage","CA1806:DoNotIgnoreMethodResults",Justification="LostKeyFinder's purpose is to get garbage collected as soon as posible")]
publicvoidAdd(TKeykey,TValuevalue)
{
WeakKeytkey=newWeakKey(key);
lock(_internalObject)
{
_internalDictionary.Add(tkey,value);
}
// This looks a bit weird but the purpose of the lost key finder is to execute
// code in some future garbage collection phase so we immediately create some garbage.