ToolboxCategory.IEnumerable.GetEnumerator 方法

定義

傳回逐一查看 ToolboxCategory 集合的列舉值。Returns an enumerator that iterates through the ToolboxCategory collection.

 virtual System::Collections::IEnumerator ^ System.Collections.IEnumerable.GetEnumerator() = System::Collections::IEnumerable::GetEnumerator;
System.Collections.IEnumerator IEnumerable.GetEnumerator ();
abstract member System.Collections.IEnumerable.GetEnumerator : unit -> System.Collections.IEnumerator
override this.System.Collections.IEnumerable.GetEnumerator : unit -> System.Collections.IEnumerator
Function GetEnumerator () As IEnumerator Implements IEnumerable.GetEnumerator

傳回

實作

備註

列舉值可用於讀取集合中的資料,但無法用於修改基礎集合。Enumerators can be used to read the data in a collection, but they cannot be used to modify the underlying collection.

一開始,列舉程式位在集合中的第一個項目之前。Initially, the enumerator is positioned before the first element in the collection. 在這個位置上,Current 並未定義。At this position, Current is undefined. 因此,在讀取 MoveNext() 的值之前,必須呼叫 Current 以將列舉值前移至集合的第一個項目。Therefore, you must call MoveNext() to advance the enumerator to the first element of the collection before reading the value of Current. 只要集合維持不變,列舉值就仍維持有效。An enumerator remains valid as long as the collection remains unchanged. 如果對集合進行變更 (例如加入、修改或刪除元素),列舉值將不再有效,而且其行為會變成未定義狀態。If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is no longer valid and its behavior is undefined.

列舉程式沒有集合的獨佔存取權,因此,列舉集合內容本質上並不是安全的執行緒程序。The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure.

適用於