ControlCollection::SyncRoot Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets an object that can be used to synchronize access to the collection of controls.

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

public:
property Object^ SyncRoot {
	virtual Object^ get() sealed;
}

Property Value

Type: System::Object^

The Object used to synchronize the collection.

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 complete, 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
Available since 1.1
Return to top
Show: