// ======================================== // constructor // ======================================== public ResourceCache() { _keyToResourceCreatorPolicyTuple = new Dictionary <object, ResourceCreatorPolicyTuple>(); _keyToResource = new Dictionary <object, IDisposable>(); _keyToImmediateResource = new Dictionary <object, IDisposable>(); _context = new ResourceUsingContext(this); _usingDepth = 0; _enabled = true; }
// ======================================== // method // ======================================== // === IDisposable ========== public void Dispose() { DisposeResources(); _keyToResourceCreatorPolicyTuple.Clear(); _keyToResource = null; _keyToImmediateResource = null; _keyToResourceCreatorPolicyTuple = null; _context = null; GC.SuppressFinalize(this); }