Cache.GetEnumerator Method
Retrieves a dictionary enumerator used to iterate through the key settings and their values contained in the cache.
[Visual Basic] Public Function GetEnumerator() As IDictionaryEnumerator [C#] public IDictionaryEnumerator GetEnumerator(); [C++] public: IDictionaryEnumerator* GetEnumerator(); [JScript] public function GetEnumerator() : IDictionaryEnumerator;
Return Value
An enumerator to iterate through the Cache object.
Remarks
Items can be added or removed from the cache while this method is enumerating through the items.
Example
[Visual Basic, C#] 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.
[Visual Basic] Dim CacheEnum As IDictionaryEnumerator = Cache.GetEnumerator() While CacheEnum.MoveNext() cacheItem = Server.HtmlEncode(CacheEnum.Current.Value.ToString()) Response.Write(cacheItem) End While [C#] IDictionaryEnumerator CacheEnum = Cache.GetEnumerator(); while (CacheEnum.MoveNext()) { cacheItem = Server.HtmlEncode(CacheEnum.Current.ToString()); Response.Write(cacheItem); }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family