title: Dup key add error on ZipFile object
body: <p>I'm trying to figure out how to first check that</p>
  
  <p>In my loop going through each file I have in a collection and trying to add it to a ZipFile collection, I've got:</p>
  
  <pre><code>using (var zip = new ZipFile())
  {
      foreach(...)
      {
           var tryFile = Directory.
                   GetFiles(fileLocalization, fileName, 
                                               SearchOption.TopDirectoryOnly);
  
           if (!string.IsNullOrEmpty(file[0]))
                zip.AddItem(file[0], GetPathStructure(file.NameInContainer));
      }
  }
  </code></pre>
  
  <p>The ZipFile type is from <code>Ionic.Zip.dll</code></p>
  
  <p>The problem is that <code>AddItem</code> errors out and I get An item with the same key has already been added.  So for example in the end it tries to add this key which was already added earlier in this zip dictionary:</p>
  
  <blockquote>
    <p>"C:\www\files\233272\Exercise Files\SampleCode\Original\MyTest.cs"</p>
  </blockquote>
  
  <p>I can't get in a check for dup to work right...it stil tries to add this twice in the loop.</p>
  
  <p>How do I check for any file[0] before trying to add?  I tried <code>LINQ .Any()</code> but not able to get the syntax right if I can even use LINQ for this.</p>
  
  <p>I tried this but I am not doing this right syntactically:</p>
  
  <pre><code>if (!string.IsNullOrEmpty(tryFile[0]) &amp;&amp; !zip.Contains(tryFile[0])
  </code></pre>
  
  <p>also tried</p>
  
  <pre><code>if (!string.IsNullOrEmpty(tryFile[0]) &amp;&amp; !zip.Any(zip[tryFile[0]])
  </code></pre>
  
  <p>also tried</p>
  
  <pre><code>if (!string.IsNullOrEmpty(tryFile[0]) &amp;&amp; !zip.ContainsEntry(tryFile[0]))
  </code></pre>