title: GetInvocationList of an event in VB.NET
body: <p>I am trying to learn some WCF principles by following an example of a WCF application (from Sacha Barber). </p>
  
  <p>Now I would like to convert the following function into VB.NET</p>
  
  <pre><code>private void BroadcastMessage(ChatEventArgs e)
  {
  
      ChatEventHandler temp = ChatEvent;
  
      if (temp != null)
      {
          foreach (ChatEventHandler handler in temp.GetInvocationList())
          {
              handler.BeginInvoke(this, e, new AsyncCallback(EndAsync), null);
          }
      }
  }
  </code></pre>
  
  <p>but I have some problems, because the following code is not accepted by the compiler</p>
  
  <pre><code>Private Sub BroadcastMessage(ByVal e As ChatEventArgs)
  
      Dim handlers As EventHandler(Of ChatEventArgs) = ChatEvent
  
      If handlers IsNot Nothing Then
  
          For Each handler As EventHandler(Of ChatEventArgs) In handlers.GetInvocationList()
  
              handler.BeginInvoke(Me, e, New AsyncCallback(AddressOf EndAsync), Nothing)
  
          Next
  
      End If
  
  End Sub
  </code></pre>
  
  <p>it says </p>
  
  <blockquote>
    <p>Public Shared Event ChatEvent(sender
    As Object, e As ChatEventArgs)' is an
    event, and cannot be called directly</p>
  </blockquote>
  
  <p>Coming to the point, <strong>is it then possible in VB.NET get the handlers linked to a certain event in some other way?</strong></p>