C# ArrayList Synchronized(ArrayList)
Description
ArrayList Synchronized(ArrayList)
returns an ArrayList
wrapper that is synchronized (thread safe).
Syntax
ArrayList.Synchronized(ArrayList)
has the following syntax.
[HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true)]
public static ArrayList Synchronized(
ArrayList list
)
Parameters
ArrayList.Synchronized(ArrayList)
has the following parameters.
list
- The ArrayList to synchronize.
Returns
ArrayList.Synchronized(ArrayList)
method returns An ArrayList wrapper that is synchronized (thread safe).
Example
The following code example shows how to synchronize an ArrayList, determine if an ArrayList is synchronized and use a synchronized ArrayList.
using System;/*from ww w . j a va 2 s.c o m*/
using System.Collections;
public class SamplesArrayList {
public static void Main() {
ArrayList myAL = new ArrayList();
ArrayList mySyncdAL = ArrayList.Synchronized( myAL );
Console.WriteLine(myAL.IsSynchronized);
Console.WriteLine(mySyncdAL.IsSynchronized);
}
}
The code above generates the following result.