| Dart.PowerTCP.Mail Namespace > Attachments Class > GetEnumerator Method : GetEnumerator() Method |
Returns an enumerator for the collection.
[Visual Basic]
Overloads Overrides Public Function GetEnumerator() As IEnumerator[C#]
public override IEnumerator GetEnumerator();[C++]
public: IEnumerator* GetEnumerator(); override [C++/CLI]
public:
IEnumerator^ GetEnumerator(); override An IEnumerator for the entire collection.
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. IEnumerator.Resetalso brings the enumerator back to this position. At this position, calling IEnumerator.Current throws an exception. Therefore, you must call IEnumerator.MoveNext to advance the enumerator to the first element of the collection before reading the value of IEnumerator.Current.
IEnumerator.Current returns the same object until either IEnumerator.MoveNext or IEnumerator.Reset is called. IEnumerator.MoveNext sets IEnumerator.Current 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 IEnumerator.MoveNext returns false. If the last call to IEnumerator.MoveNext returned false, calling IEnumerator.Current throws an exception. To set IEnumerator.Current to the first element of the collection again, you can call IEnumerator.Reset followed by IEnumerator.MoveNext.
This method is used by the "foreach" construct.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Attachments Class | Attachments Members | Overload List
Send comments on this topic.
Documentation version 3.1.
© 2009 Dart Communications. All rights reserved.