PrinterSettings.PaperSizeCollection.GetEnumerator 方法

定义

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

public:
 System::Collections::IEnumerator ^ GetEnumerator();
public System.Collections.IEnumerator GetEnumerator ();
member this.GetEnumerator : unit -> System.Collections.IEnumerator
Public Function GetEnumerator () As IEnumerator

返回

IEnumerator

IEnumerator 的一个 PrinterSettings.PaperSizeCollectionAn IEnumerator for the PrinterSettings.PaperSizeCollection.

注解

此方法实例化一个枚举器,该枚举器获取集合的当前状态的快照。This method instantiates an enumerator that takes a snapshot of the current state of the collection. 枚举器没有对集合的独占访问权限,因此多个枚举器可以同时访问同一集合。The enumerator does not have exclusive access to the collection, so multiple enumerators can have access to the same collection at the same time. 因此,对集合所做的任何更改(直接或通过其他枚举器)都可能导致 CurrentMoveNext 引发异常。Therefore, any changes made to the collection, either directly or through another enumerator, can cause Current or MoveNext to throw an exception.

同时从同一集合实例化的两个枚举器可以包含集合的不同快照。Two enumerators instantiated from the same collection at the same time can contain different snapshots of the collection.

从枚举器中删除对象还会将它们从集合中删除。Removing objects from the enumerator also removes them from the collection.

适用于

另请参阅