Cache.GetEnumerator Метод
Определение
Получение перечислителя словаря, используемого для итерации в ключевых параметрах и их значениях, содержащихся в кэше.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
Возвращаемое значение
Перечислитель для итерации в объекте Cache.An enumerator to iterate through the Cache object.
Примеры
В следующем примере создается IDictionaryEnumerator объект CacheEnum
с помощью GetEnumerator
метода.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
Комментарии
Элементы можно добавлять в кэш или удалять из него, пока этот метод перебирает элементы.Items can be added to or removed from the cache while this method is enumerating through the items.