title: C# - How to return value with anonymous method?
body: <p>This code fails:</p>
  
  <pre><code>    public bool generateNewIdentity()
      {
          TCPClient torIdentityClient = new TCPClient();
  
          torIdentityClient.OnConnect += delegate ()
          {
              torIdentityClient.Write("AUTHENTICATE \"*********************************\"\r\nSIGNAL NEWNYM\r\n");
          };
  
          torIdentityClient.OnRead += delegate (TCPClient tcpClient, string[] dataReadArray)
          {
              if(dataReadArray[0] == "250 OK")
              {
                  return true;
              }
          };
  
          torIdentityClient.Delimiter = "\r\n";
          torIdentityClient.Connect("127.0.0.1", 9151);
      }
  </code></pre>
  
  <p>It's being returned a string array containing <code>["250 OK", "250 OK"]</code></p>
  
  <p>The exception it is giving me is <code>Anonymous function converted to a void returning delegate cannot return a value</code>.</p>
  
  <p>I am trying to make it return true, if it gets 250 OK.</p>
  
  <p>How can I resolve this issue?</p>