July 17, 2008

How to use named system events (global events) in C#?

There are three classes relating to windows events, EventWaitHandle, AutoResetEvent, and ManualResetEvent.

EventWaitHandle
The EventWaitHandle class can represent either automatic or manual reset events and either local events or named system events.

AutoResetEvent
The AutoResetEvent class derives from EventWaitHandle and represents a local event that resets automatically.

ManualResetEvent
The ManualResetEvent class derives from EventWaitHandle and represents a local event that must be reset manually.

Tips:
According to above description, you should use EventWaitHanlde class to represent named system events, of course it can be either automatic or manual reset events.

MSDN reference:
http://msdn.microsoft.com/en-us/library/ksb7zs2x.aspx