When should a ManualResetEvent be disposed?
问题 I'm using an application that synchronizes threads using ManualResetEvent. FxCop told me to dispose those objects. I found the following discussion which told me the same: Do I need to Dispose() or Close() an EventWaitHandle? But I don't know when to dispose an instance of a ManualResetEvent. The following simplified code demonstrates the problem: private void btn_Click(object sender, EventArgs e) { var mre = new ManualResetEvent(false); new Thread(() => this.SetEvent(mre)).Start(); for (int