title: How to count how many listeners are hooked to an event?
body: <p>Assuming I have declared</p>
  
  <pre><code>public event EventArgs&lt;SyslogMessageEventArgs&gt; MessageReceived;
  
  public int SubscribedClients
  {
      get [...]
  }
  </code></pre>
  
  <p>I would like to count how many "subscribed clients" my class has. I need to sum those that subscribed over network though my APIs (not shown in the fragment) <strong>plus</strong> those that did <code>channel.MessageReceived+=myMethod;</code>.</p>
  
  <p>I know that C# events may be declared explicitly with <code>add</code> and <code>remove</code> statements, and there I can surely count + or -1 to a local counter, but I never wrote code for explicit events in C#, so I don't know exactly what more to perform on add and remove rather than updating the counter.</p>
  
  <p>Thank you.</p>