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 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈