Synchronize an ArrayList in CSharp
Description
The following code shows how to synchronize an ArrayList.
Example
using System;/* ww w .j a va2 s . com*/
using System.Collections;
public class SamplesArrayList {
public static void Main() {
ArrayList myAL = new ArrayList();
myAL.Add( "The" );
myAL.Add( "quick" );
myAL.Add( "brown" );
myAL.Add( "fox" );
ArrayList mySyncdAL = ArrayList.Synchronized( myAL );
Console.WriteLine(myAL.IsSynchronized);
Console.WriteLine(mySyncdAL.IsSynchronized);
}
}
The code above generates the following result.