Export (0) Print
Expand All

Cache.GetEnumerator Method

Retrieves a dictionary enumerator used to iterate through the key settings and their values contained in the cache.

Namespace: System.Web.Caching
Assembly: System.Web (in system.web.dll)

public IDictionaryEnumerator GetEnumerator ()
public IDictionaryEnumerator GetEnumerator ()
public function GetEnumerator () : IDictionaryEnumerator
Not applicable.

Return Value

An enumerator to iterate through the Cache object.

Items can be added to or removed from the cache while this method is enumerating through the items.

The following example creates an IDictionaryEnumerator object, CacheEnum, using the GetEnumerator method. The enumerator moves through the cache, converts the value of each cached item to a string, and then writes the values to a Web Forms page.

IDictionaryEnumerator CacheEnum = Cache.GetEnumerator();
while (CacheEnum.MoveNext())
{
  cacheItem = Server.HtmlEncode(CacheEnum.Current.ToString()); 
  Response.Write(cacheItem);
}

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft