title: Can't seem to Pass EventArgs By Reference
body: <p>I have a class that raises an event. I want the subscriber to be able to modify the values being passed in the EventArgs.</p>
  
  <p>In the class that raises the events:</p>
  
  <pre><code>    class Factory
      {
      public event EventHandler&lt;MessageReceivedEventArgs&gt; MessageReceived;
  
      private IServerLib _myObject;
  
      public void Connect()
      {
          _myObject = new ServerLib();
          _myObject.AddMessageReceivedHandler((short terminal, ref string message, ref short functionNo) =&gt;
          {
              MessageReceivedEventArgs args = new MessageReceivedEventArgs { Terminal = terminal, Message = message, FunctionNo = functionNo };
              MessageReceivedEvent(ref args);
          });
      }
  
      private void MessageReceivedEvent(ref MessageReceivedEventArgs args)
      {
          EventHandler&lt;MessageReceivedEventArgs&gt; handler = MessageReceived;
          if (handler != null)
          {
              handler(this, args);
          }
      }
  
      public class MessageReceivedEventArgs : EventArgs
      {
          public short Terminal { get; set; }
          public string Message { get; set; }
          public short FunctionNo { get; set; }
      }
  }
  
  
  interface IServerLib
      {
          void AddMessageReceivedHandler(MessageReceivedEventHandler action);
      }
      public delegate void MessageReceivedEventHandler(short terminal, ref string message, ref short functionNo);
  </code></pre>
  
  <p>The subscriber (which happens to be VB) looks like this:</p>
  
  <pre><code>Dim WithEvents _va As MyAssembly.MyClass
  
  Private Sub _va_MessageReceived(sender As Object, e As Factory.MessageReceivedEventArgs) Handles _va.MessageReceived
      Debug.WriteLine($"Message: {e.Message} Terminal: {e.Terminal} Function: {e.FunctionNo}")
      If e.Message = "1" Then
          e.Message = ""
          e.FunctionNo = 0
          Debug.WriteLine("Cancelled")
      End If
  End Sub
  </code></pre>
  
  <p>This raises the event, but setting the e.Message and e.Function do not seem to set the values. Am I doing something wrong?</p>