Return an ArrayList wrapper that is synchronized (thread safe) in CSharp
Description
The following code shows how to return an ArrayList wrapper that is synchronized (thread safe).
Example
using System;/*from www.j a v a 2s .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.