title: C# conditional using block statement
body: <p>I have the follow code but it is awkward. How could I better structure it? Do I have to make my consuming class implement IDisposable and conditionally construct the network access class and dispose it when I am done?</p>
  
  <pre><code>    protected void ValidateExportDirectoryExists()
      {
          if (useNetworkAccess)
          {
              using (new Core.NetworkAccess(username, password, domain))
              {
                  CheckExportDirectoryExists();
              }
          }
          else
          {
              CheckExportDirectoryExists();
          }
      }
  </code></pre>