using System;
using System.Collections;
using System.Threading;
class MainClass
{
public static ArrayList MyList = new ArrayList();
static void Main(string[] args)
{
Thread ThreadOne = new Thread(new ThreadStart(MonitorExample));
ThreadOne.Start();
}
static void MonitorExample()
{
Monitor.Enter(MyList);
MyList.Add("a value");
Monitor.Exit(MyList);
}
}
|