Assuming you have a good reason to hold onto an object for the lifetime of the application (see comments section), you still shouldn't store it in a static variable. Instead, store it in an object that represents the lifepsan of the application; for example, in a Windows Forms application, you could store it as a member variable of the main form, and in a web application you could store it as a member of your HttpApplication (global.asax.cs). Both a form and a web application are themselves disposable, so you can override and extend their Dispose
method and dispose of your unmanaged resource there. Both Disposes will be called implicitly when the application exits.
class MainForm : Form
{
private readonly AutoResetEvent _global = new AutoResetEvent();
public override void Dispose()
{
_global.Dispose();
base.Dispose();
}
}