title: Return bool with if statement
body: <p>I need some help with my code since it always return false, using C# XNA 4.0</p>
  
  <p>On my Game1.cs I run this code</p>
  
  <pre><code>if (!Connection.sendPacketBool("Check", versionPacket))
          {
              Connection.closeConnection();
              this.Exit();
          }
  </code></pre>
  
  <p>on my class connection I have this one</p>
  
  <pre><code>public static bool final;
  public static bool sendPacketBool(String type, String data)
      {
          try
          {
              NetworkComms.SendObject(type, serverIp, serverPort, data);
              NetworkComms.AppendGlobalIncomingPacketHandler&lt;string&gt;("ClientV",
             (header, connection, array) =&gt;
             {
                 if (array == "false")
                 {
                     final = false;
                 }
                 else
                 {
                     final = true;
                 }
             });
          }
          catch (Exception ex)
          {
  
          }
          if (!final)
          {
              return false;
          }
          else
          {
              return true;
          }
      }
  </code></pre>
  
  <p>The thing is final is always false except when I do </p>
  
  <pre><code>        public static bool final = true;
  </code></pre>
  
  <p>How can I change this code so it returns true or false? I cant do</p>
  
  <pre><code>if (array == "false")
                 {
                     final = false;
                     return false;
                 }
                 else
                 {
                     final = true;
                     return true;
                 }
  </code></pre>
  
  <p>Since I get the error </p>
  
  <blockquote>
    <p>NetworkComms.AppendGlobalIncomingPacketHandler returns void a
    return keyword must not be followed by an object expression</p>
  </blockquote>
  
  <p>Thanks</p>