MemoryCache.GetEnumerator Method ()

.NET Framework (current version)

Creates an enumerator that can be used to iterate through a collection of cache entries.

Namespace:   System.Runtime.Caching
Assembly:  System.Runtime.Caching (in System.Runtime.Caching.dll)

protected override IEnumerator<KeyValuePair<string, object>> GetEnumerator()

Return Value

Type: System.Collections.Generic.IEnumerator<KeyValuePair<String, Object>>

The enumerator object that provides access to the items in the cache.

The enumerator that is returned by the GetEnumerator method can be used to iterate over entries in the cache.


Retrieving an enumerator for a MemoryCache instance is a resource-intensive and blocking operation. Therefore, the enumerator should not be used in production applications.

.NET Framework
Available since 4.0
Return to top