ValidatorCollection.SyncRoot Property


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

Gets an object that can be used to synchronize the ValidatorCollection collection.

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

public object SyncRoot { get; }

Property Value

Type: System.Object

The Object to synchronize the collection with.

The following code example demonstrates using the SyncRoot property.

// Get 'Validators' of the page to myCollection.
ValidatorCollection myCollection1 = Page.Validators;

// Get 'IsReadOnly' property of 'ValidatorCollection'.
bool readOnly_bool = myCollection1.IsReadOnly;

// Get 'IsSynchronized' property of 'ValidatorCollection'.
bool synchronized_bool = myCollection1.IsSynchronized;

// Get a synchronized object of the 'ValidatorCollection'.
ValidatorCollection myCollection2 = (ValidatorCollection)myCollection1.SyncRoot;

.NET Framework
Available since 1.1
Return to top