Releases all resources that are used by the current instance of the MemoryCache class.
Assembly: System.Runtime.Caching (in System.Runtime.Caching.dll)
Each MemoryCache instance is bound to the AppDomainUnloaded event. However, during application-domain shutdown, if a memory-based cache has not been explicitly disposed, the cache instance will automatically call the method.
The disposed cache instance is shut down using the following steps:
The state of the cache is set to indicate that the cache is disposed. Any attempt to call public caching methods that change the state of the cache, such as methods that add, remove, or retrieve cache entries, might cause unexpected behavior. For example, if you call the Set method after the cache is disposed, a no-op error occurs. If you attempt to retrieve items from the cache, the Get method will always return null.
Performance counter information is no longer raised from the current cache instance.
All references to cached objects held by the current cache instance are released.
Any CacheEntryChangeMonitor instances that are currently monitoring entries in the cache are notified.
Callback objects that provide notification of changes for those monitors are called.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.