DTSReadOnlyCollectionBase.IsSynchronized 속성

Gets a value that indicates whether access to the DTSReadOnlyCollectionBase is synchronized (thread-safe).

네임스페이스:  Microsoft.SqlServer.Dts.Runtime
어셈블리:  Microsoft.SqlServer.ManagedDTS(Microsoft.SqlServer.ManagedDTS.dll)

구문

‘선언
Public ReadOnly Property IsSynchronized As Boolean 
    Get
‘사용 방법
Dim instance As DTSReadOnlyCollectionBase 
Dim value As Boolean 

value = instance.IsSynchronized
public bool IsSynchronized { get; }
public:
virtual property bool IsSynchronized {
    bool get () sealed;
}
abstract IsSynchronized : bool 
override IsSynchronized : bool
final function get IsSynchronized () : boolean

속성 값

유형: System.Boolean
true if access to the DTSReadOnlyCollectionBase is synchronized (thread-safe); otherwise, false. The default is false.

구현

ICollection.IsSynchronized

주의

Implements ICollection.IsSynchronized. If a collection is thread safe, the IsSynchronized property returns true, and the programmer does not have to do anything to keep the collection thread safe.

If the property returns false, then the SyncRoot property returns an object that can be used with the C# lock keyword. For more information, see ICollection.IsSynchronized.

The ArrayList is a .NET Framework Class that inherits and implements the IsSynchronized property. The following code example shows how to synchronize an ArrayList, determine if an ArrayList is synchronized and use a synchronized ArrayList.

using System;
using System.Collections;
public class SamplesArrayList  
{
   public static void Main()  
   {
      // Creates and initializes a new ArrayList.
      ArrayList myAL = new ArrayList();
      myAL.Add( "The" );
      myAL.Add( "quick" );
      myAL.Add( "brown" );
      myAL.Add( "fox" );

      // Creates a synchronized wrapper around the ArrayList.
      ArrayList mySyncdAL = ArrayList.Synchronized( myAL );

      // Displays the sychronization status of both ArrayLists.
      Console.WriteLine( "myAL is {0}.", myAL.IsSynchronized ? "synchronized" : "not synchronized" );
      Console.WriteLine( "mySyncdAL is {0}.", mySyncdAL.IsSynchronized ? "synchronized" : "not synchronized" );
   }
}
Imports System
Imports System.Collections
Public Class SamplesArrayList
   Public Shared  Sub Main()
      ' Creates and initializes a new ArrayList.
      Dim myAL As ArrayList =  New ArrayList() 
      myAL.Add("The")
      myAL.Add("quick")
      myAL.Add("brown")
      myAL.Add("fox")
 
      ' Creates a synchronized wrapper around the ArrayList.
      Dim mySyncdAL As ArrayList =  ArrayList.Synchronized(myAL) 
 
      ' Displays the sychronization status of both ArrayLists.
      Console.WriteLine("myAL is {0}.", myAL.IsSynchronized ? "synchronized" : "not synchronized")
      Console.WriteLine("mySyncdAL is {0}.", mySyncdAL.IsSynchronized ? "synchronized" : "not synchronized")
   End Sub
End Class

Sample Output:

myAL is not synchronized.

mySyncdAL is synchronized.

참고 항목

참조

DTSReadOnlyCollectionBase 클래스

Microsoft.SqlServer.Dts.Runtime 네임스페이스