[
  {
    "Id": "265639",
    "ThreadId": "77695",
    "Html": "<p>I have an object which I currently serialize to a file.&nbsp; It gets very large so I want to zip it.&nbsp; So I serialize itain to a MemoryStream and then add it to the zip.&nbsp; The memory stream does contain the serialized object but the zip file contains an empty file.&nbsp; I would appreciate some help on why this is happening.&nbsp; My code is below</p>\r\n<p>&nbsp;</p>\r\n<p>Thanks</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">var</span> ms = <span style=\"color:Blue\">new</span> MemoryStream();\r\n<span style=\"color:Blue\">var</span> binSerializer = <span style=\"color:Blue\">new</span> BinaryFormatter();\r\nbinSerializer.Serialize(ms, saveFile);\r\n             \r\n<span style=\"color:Blue\">using</span> (<span style=\"color:Blue\">var</span> zip = <span style=\"color:Blue\">new</span> ZipFile()) {\r\n       ZipEntry e = zip.AddEntry(filename, <span style=\"color:#A31515\">&quot;&quot;</span>, ms);\r\n       zip.Save(filename);\r\n}\r\n  \r\n</pre>\r\n</div>",
    "PostedDate": "2009-12-10T03:05:16.28-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "265642",
    "ThreadId": "77695",
    "Html": "<p>Duh!</p>\r\n<p>Read before you go into print.....&nbsp; Sorry Folks I now saw the post below with the same problem and I can confirm that converting the stream to a byte array first does indeed work, as does setting the stream position to zero before trying to zip it.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-12-10T03:12:09.71-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]