ArrayList.IsSynchronized Property tells whether access to the ArrayList is synchronized (thread safe).
Imports System
Imports System.Collections
Public Class SamplesArrayList
Public Shared Sub Main()
Dim myAL As New ArrayList()
myAL.Add("A")
myAL.Add("B")
myAL.Add("C")
myAL.Add("D")
Dim mySyncdAL As ArrayList = ArrayList.Synchronized(myAL)
Dim str As String
If myAL.IsSynchronized Then
str = "synchronized"
Else
str = "not synchronized"
End If
Console.WriteLine("myAL is {0}.", str)
If mySyncdAL.IsSynchronized Then
str = "synchronized"
Else
str = "not synchronized"
End If
Console.WriteLine("mySyncdAL is {0}.", str)
End Sub
End Class
Related examples in the same category