TreeNodeCollection.GetEnumerator Method
Assembly: System.Web (in system.web.dll)
Use the GetEnumerator method to create an enumerator that can be easily iterated through to get each item in the TreeNodeCollection. To get the item currently pointed to in the enumerator, use the IEnumerator.Current property. Use the IEnumerator.MoveNext method to move to the next item. If you need to move the enumerator back to the beginning of the collection, use the IEnumerator.Reset method.
Note |
|---|
| After you create an enumerator or use the IEnumerator.Reset method, you must call the IEnumerator.MoveNext method. Otherwise, the item represented by the IEnumerator.Current property is undefined. |
As an alternative, you can also use the CopyTo method to create an System.Array object that can be used to access the items in the collection. Another alternative is to use a foreach or For Each structure to iterate through the collection.
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note