ControlCollection.SyncRoot プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ControlCollection.SyncRoot プロパティの意味・解説 

ControlCollection.SyncRoot プロパティ

コントロールコレクションへのアクセス同期するために使用するオブジェクト取得します

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文構文

使用例使用例

Button コントロール (myButton) の ControlCollection コレクション内を列挙するメソッド作成するコード例次に示します列挙子が作成されると、操作スレッド セーフかどうか確認するために IsSynchronized プロパティチェックされます。スレッド セーフない場合は、SyncRoot プロパティ使用して操作スレッド セーフにするためのオブジェクト取得されます。列挙処理が完了すると、IsReadOnly プロパティの値が、ページLabel コントロールText プロパティ値として書き込まれます。

' Create a method that enuberates through a 
' button's ControlCollection in a thread-safe manner.  
Public Sub ListControlCollection(sender As
 Object, e As EventArgs)
   Dim myEnumerator As IEnumerator = myButton.Controls.GetEnumerator()

   ' Check the IsSynchronized property. If False,
   ' use the SyncRoot method to get an object that 
   ' allows the enumeration of all controls to be 
   ' thread safe.
   If myButton.Controls.IsSynchronized = False
 Then
     SyncLock myButton.Controls.SyncRoot
       While (myEnumerator.MoveNext())

       Dim myObject As Object
  = myEnumerator.Current
           
         Dim childControl As LiteralControl
 = CType(myEnumerator.Current, LiteralControl)
         Response.Write("<b><br> This is the  text
 of the child Control  </b>: " & _
                        childControl.Text)
       End While
      msgReadOnly.Text = myButton.Controls.IsReadOnly.ToString()
      
      End SyncLock
   End If       
 End Sub
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ControlCollection クラス
ControlCollection メンバ
System.Web.UI 名前空間
Control.Controls プロパティ



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ControlCollection.SyncRoot プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ControlCollection.SyncRoot プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS