What is the difference between ManualResetEvent and AutoResetEvent in .NET?

Ben McNiel picture Ben McNiel · Sep 30, 2008 · Viewed 176.6k times · Source

I have read the documentation on this and I think I understand. An AutoResetEvent resets when the code passes through event.WaitOne(), but a ManualResetEvent does not.

Is this correct?

Answer

Dan Goldstein picture Dan Goldstein · Sep 30, 2008

Yes. It's like the difference between a tollbooth and a door. The ManualResetEvent is the door, which needs to be closed (reset) manually. The AutoResetEvent is a tollbooth, allowing one car to go by and automatically closing before the next one can get through.