Cache.GetEnumerator Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves a dictionary enumerator used to iterate through the key settings and their values contained in the cache.
public:
System::Collections::IDictionaryEnumerator ^ GetEnumerator();
public System.Collections.IDictionaryEnumerator GetEnumerator ();
member this.GetEnumerator : unit -> System.Collections.IDictionaryEnumerator
Public Function GetEnumerator () As IDictionaryEnumerator
Returns
An enumerator to iterate through the Cache object.
Examples
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);
}
Dim CacheEnum As IDictionaryEnumerator = Cache.GetEnumerator()
While CacheEnum.MoveNext()
cacheItem = Server.HtmlEncode(CacheEnum.Current.Value.ToString())
Response.Write(cacheItem)
End While
Remarks
Items can be added to or removed from the cache while this method is enumerating through the items.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應