title: How to call a web service method in c#
body: <p>I want to know how to safely call a WCF web service method.  Are both of these methods acceptable/equivalent?  Is there a better way?</p>
  
  <p>1st way:</p>
  
  <pre><code>public Thing GetThing()
  {
      using (var client = new WebServicesClient())
      {
          var thing = client.GetThing();
          return thing;
      }
  }
  </code></pre>
  
  <p>2nd way:</p>
  
  <pre><code>public Thing GetThing()
  {
      WebServicesClient client = null;
      try
      {
          client = new WebServicesClient();
          var thing = client.GetThing();
          return thing;
      }
      finally
      {
          if (client != null)
          {
              client.Close();
          }
      }
  }
  </code></pre>
  
  <p>I want to make sure that the client is properly closed and disposed of.  </p>
  
  <p>Thanks</p>