共用方式為


ValidatorCollection.IsSynchronized 屬性

定義

取得值,指出 ValidatorCollection 集合是否已同步化。

public:
 property bool IsSynchronized { bool get(); };
public bool IsSynchronized { get; }
member this.IsSynchronized : bool
Public ReadOnly Property IsSynchronized As Boolean

屬性值

Boolean

如果同步處理集合,則為 true,否則為 false

實作

範例

下列程式碼範例示範如何使用 IsSynchronized 屬性。

// 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))

備註

如果集合已同步處理,則為安全線程。

適用於

另請參閱