title: Check value of AutoResetEvent without affecting event
body: <p>I'm creating some "instrumentation" inside a multi-threaded server in .NET (C#).</p>
  
  <p>It's fairly easy to check the value of a .NET <code>ManualResetEvent</code> without concern for changing the value:</p>
  
  <pre><code>aManualResetEvent.WaitOne( 0 );
  </code></pre>
  
  <p>returns a boolean without waiting on the event.</p>
  
  <p>However, I seem to be at a loss for getting the same information from an <code>AutoResetEvent</code>; if you call <code>anAutoResetEvent.WaitOne( 0 )</code> on a <code>set</code> event, it will reset the event while returning (by definition).</p>
  
  <p>The best option I can determine at this point is to change the <code>AutoResetEvent</code> to a <code>ManualResetEvent</code> and manually reset when actually testing the event:</p>
  
  <pre><code>ManualResetEvent theEventFormerlyKnownAsAutoResetEvent;
  ...
  
  
  // Using the event:
  if ( theEventFormerlyKnownAsAutoResetEvent.WaitOne( timeout )
  {
      theEventFormerlyKnownAsAutoResetEvent.Reset();
      ...
  }
  ...
  
  // Instrumentation to get event state (shouldn't change anything):
  bool eventIsSet = theEventFormerlyKnownAsAutoResetEvent.WaitOne( 0 );
  // Update instrumentation
  </code></pre>
  
  <p>Is there a better way of checking the state of an <code>AutoResetEvent</code>?  I would prefer the intrinsic atomicity of the <code>AutoResetEvent</code> if possible.</p>