This documentation is archived and is not being maintained.

ControlCollection::GetEnumerator Method

Retrieves an enumerator that can iterate through the ControlCollection object.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public:
virtual IEnumerator^ GetEnumerator()

Return Value

Type: System.Collections::IEnumerator
The enumerator to iterate through the collection.

Implements

IEnumerable::GetEnumerator()

The following code example creates a method that enumerates through the ControlCollection collection of a Button control, myButton. When the enumerator is created, the IsSynchronized property is checked to see if the operation is thread safe, and if it is not, the SyncRoot property is used to obtain an object to make the operation thread safe. When the enumeration is completed, the value of the IsReadOnly property is written as the Text property of a Label control on the containing page.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: