Cache.GetEnumerator Método
Definição
Recupera um enumerador de dicionário usado para iterar pelas configurações de chave e os valores contidos no cache.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
Retornos
Um enumerador para iterar pelo objeto Cache.An enumerator to iterate through the Cache object.
Exemplos
O exemplo a seguir cria um IDictionaryEnumerator objeto, CacheEnum , usando o GetEnumerator método.The following example creates an IDictionaryEnumerator object, CacheEnum, using the GetEnumerator method. O enumerador se move pelo cache, converte o valor de cada item em cache em uma cadeia de caracteres e grava os valores em uma página Web Forms.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
Comentários
Os itens podem ser adicionados ou removidos do cache enquanto esse método está sendo enumerado pelos itens.Items can be added to or removed from the cache while this method is enumerating through the items.