System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Object

The foreach statement of the C# language (for each in Visual Basic) hides the complexity of the enumerators. Therefore, using foreach is recommended, instead of directly manipulating the enumerator.

Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.

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

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

If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns false. When the enumerator is at this position, subsequent calls to also return false. If the last call to returned false, calling throws an exception. To set to the first element of the collection again, you can call followed by .

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 . If the collection is modified between and , returns the element that it is set to, 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.

Supports a simple iteration over a .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added: an object of type 'string'

  After an enumerator is created or after a is called, must be called to advance the enumerator to the first element of the collection before reading the value of ; otherwise, is undefined.

  also throws an exception if the last call to returned false, which indicates the end of the collection.

  does not move the position of the enumerator, and consecutive calls to return the same object until either or is called.

  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 . If the collection is modified between and , returns the element that it is set to, even if the enumerator is already invalidated.

  Gets the current element in the collection.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  After an enumerator is created or after a is called, an enumerator is positioned before the first element of the collection, and the first call to moves the enumerator over the first element of the collection.

  If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns false. When the enumerator is at this position, subsequent calls to also return false until is called.

  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 . If the collection is modified between and , returns the element that it is set to, even if the enumerator is already invalidated.

  Advances the enumerator to the next element of 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
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  moves the enumerator to the beginning of the collection, before the first element. After , must be called to advance the enumerator to the first element of the collection before reading the value of .

  Sets the enumerator to its initial position, which is before the first element in the collection.