mscorlib 2.0.0.0 4.0.0.0 System.Object System.Collections.IEnumerator System.Runtime.InteropServices.ComVisible(true)

Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection.

Initially, the enumerator is positioned before the first element in the collection. The method also brings the enumerator back to this position. At this position, calling the property throws an exception. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of the property.

returns the same object until either or is called. sets to the next element.

After the end of the collection is passed, the enumerator is positioned after the last element in the collection, and calling returns false. If the last call to returned false, calling throws an exception. To reset to the first element of the collection, call followed by a call to .

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 irrecoverably invalidated and the next call to or throws an exception. If the collection is modified between calling and , returns the element to which it is currently set, even if the enumerator is already invalidated.

The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

Represents the enumerator for objects in the collection.

- Property
  2.0.0.0
  4.0.0.0
  System.Security.Policy.ApplicationTrust To be added.

  When the enumerator is created, it does not point to an object, so the property is not valid and will throw an exception if it is accessed. You must first call the method to position the cursor at the first object in the collection.

  Multiple calls to with no intervening calls to will return the same object.

  Gets the current object in the collection.

- Method
  2.0.0.0
  4.0.0.0
  System.Boolean

  The method immediately returns false if there are no objects in the collection.

  will return true until it has reached the end of the collection. It will then return false for each successive call. However, after has returned false, accessing the property will throw an exception.

  Upon creation, an enumerator is positioned before the first object in the collection, and the first call to positions the enumerator at the first object in the collection.

  Moves to the next element in the collection.

  true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

- Method
  2.0.0.0
  4.0.0.0
  System.Void

  An enumerator moves in a forward-only direction. Use this method to return the enumerator to the beginning of the collection of objects.

  The method positions the cursor at the first object in the collection. After calling , you do not need to call the method to move the cursor forward to the first object.

  Resets the enumerator to the beginning of the collection.

- Property
  2.0.0.0
  4.0.0.0
  System.Object To be added.

  Do not call this method; use the property instead.

  Gets the current in the collection.