IsSynchronized property of ArrayList
In this article I will explain the IsSynchronized property of ArrayList.
Introduction
The IsSynchronized property of ArrayList gets a value indicating whether access to the ArrayList is synchronized (thread safe) or not if yes then it return true otherwise it return false.
Example
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
// Creates a new ArrayList.
ArrayList days = new ArrayList();
days.Add("Sunday");
days.Add("Monday");
days.Add("Tuesday");
days.Add("Wednesday");
// Creates a Synchronized arraylist
ArrayList synchro = ArrayList.Synchronized(days);
// Displays whether the ArrayList is Synchronized or not
Console.WriteLine("ArrayList days is Synchronized or not: {0}.", days.IsSynchronized );
Console.WriteLine("ArrayList synchro is Synchronized or not: {0}.", synchro.IsSynchronized);
}
}
}
|
Output
Ask Your Question
Got a programming related question? You may want to post your question here