title: Find compressed total ZipFile size in KB (not length)
body: <p>I have below section of code in my application. I would like to store Zipped file size in DB but when I store buffer value it is different from compressed zip file size. </p>
  
  <p>How to identify exact Zip file size in C#?</p>
  
  <pre><code>using (ZipFile zip = new ZipFile())
  {
      zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
  
      foreach (Docs Docs in FileByteCollection)
      {
          doctype = "Insured";
          country = "US";
  
          if (doctype == "Local")
              Docs.DocumentName = "LocalDoc.pdf";
  
          else if (doctype != "Local")
              Docs.DocumentName = "Interantional.pdf"
  
          zip.AddEntry(Docs.DocName, Docs.DocumentContent);
      }
  
      zip.Save(outputMemStream);
  }
  </code></pre>
  
  <p>Current logic to get FileSize:</p>
  
  <pre><code>byte[] byteArr = ((MemoryStream)outputMemStream).ToArray();
  
  int totalSize = 0;
  
  foreach (byte b in byteArr)
      totalSize = totalSize + b;
  </code></pre>