using System.Threading; AutoResetEvent autoReset = new AutoResetEvent(false); // Thread 1 waits for the event autoReset.WaitOne(); // Thread 2 sets the event autoReset.Set();
using System.Threading; AutoResetEvent autoReset = new AutoResetEvent(false); // Do some work autoReset.Dispose();In this example, the `autoReset` AutoResetEvent instance is disposed of after some work is done to release the resources used by the instance. The AutoResetEvent class is part of the System.Threading package library.