ToolboxCategoryItems.GetEnumerator 方法

定义

返回一个循环访问 ToolboxCategoryItems 集合的枚举数。Returns an enumerator that iterates through the ToolboxCategoryItems collection.

public:
 virtual System::Collections::Generic::IEnumerator<System::Activities::Presentation::Toolbox::ToolboxCategory ^> ^ GetEnumerator();
public System.Collections.Generic.IEnumerator<System.Activities.Presentation.Toolbox.ToolboxCategory> GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.Generic.IEnumerator<System.Activities.Presentation.Toolbox.ToolboxCategory>
override this.GetEnumerator : unit -> System.Collections.Generic.IEnumerator<System.Activities.Presentation.Toolbox.ToolboxCategory>
Public Function GetEnumerator () As IEnumerator(Of ToolboxCategory)

返回

实现

注解

枚举数可用于读取集合中的数据,但不能用于修改基础集合。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. 在此位置上,未定义 CurrentAt 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.

适用于