ValidatorCollection.SyncRoot Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets an object that can be used to synchronize the ValidatorCollection collection.
public:
property System::Object ^ SyncRoot { System::Object ^ get(); };
public object SyncRoot { get; }
member this.SyncRoot : obj
Public ReadOnly Property SyncRoot As Object
Property Value
The Object to synchronize the collection with.
Implements
Examples
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;
myCollection1.Add(myCollection1[0]);
' Get 'Validators' of the page to myCollection.
Dim myCollection1 As ValidatorCollection = Page.Validators
' Get 'IsReadOnly' property of 'ValidatorCollection'.
Dim readOnly_bool As Boolean = myCollection1.IsReadOnly
' Get 'IsSynchronized' property of 'ValidatorCollection'.
Dim synchronized_bool As Boolean = myCollection1.IsSynchronized
' Get a synchronized object of the 'ValidatorCollection'.
Dim myCollection2 As ValidatorCollection = CType(myCollection1.SyncRoot, ValidatorCollection)
myCollection1.Add(myCollection1(0))
Applies to
See also
Samarbejd med os på GitHub
Kilden til dette indhold kan findes på GitHub, hvor du også kan oprette og gennemse problemer og pullanmodninger. Du kan få flere oplysninger i vores vejledning til bidragydere.