# C1.Zip.C1ZipEntryCollection.Add

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Zip_C1ZipEntryCollection_Add_" data-uid="C1.Zip.C1ZipEntryCollection.Add*">Add Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Zip_C1ZipEntryCollection_Add_" data-uid="C1.Zip.C1ZipEntryCollection.Add*"></a>
<h4 id="C1_Zip_C1ZipEntryCollection_Add_System_IO_Stream_System_String_System_DateTime_" data-uid="C1.Zip.C1ZipEntryCollection.Add(System.IO.Stream,System.String,System.DateTime)">Add(Stream, string, DateTime)</h4>
<div class="markdown level1 summary"><p>Adds a stream to the current zip file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Add(Stream stream, string entryName, DateTime dateTime)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Add(stream As Stream, entryName As String, dateTime As Date)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a></td>
      <td><span class="parametername">stream</span></td>
      <td><p>Stream that contains data for the new entry.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">entryName</span></td>
      <td><p>Name to be used for the new entry.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.datetime">DateTime</a></td>
      <td><span class="parametername">dateTime</span></td>
      <td><p>The date and time when the file was last modified.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Zip_C1ZipEntryCollection_Add_" data-uid="C1.Zip.C1ZipEntryCollection.Add*"></a>
<h4 id="C1_Zip_C1ZipEntryCollection_Add_System_IO_Stream_System_String_" data-uid="C1.Zip.C1ZipEntryCollection.Add(System.IO.Stream,System.String)">Add(Stream, string)</h4>
<div class="markdown level1 summary"><p>Adds a stream to the current zip file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Add(Stream stream, string entryName)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Add(stream As Stream, entryName As String)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a></td>
      <td><span class="parametername">stream</span></td>
      <td><p>Stream that contains data for the new entry.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">entryName</span></td>
      <td><p>Name to be used for the new entry.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Zip_C1ZipEntryCollection_Add_" data-uid="C1.Zip.C1ZipEntryCollection.Add*"></a>
<h4 id="C1_Zip_C1ZipEntryCollection_Add_System_String_" data-uid="C1.Zip.C1ZipEntryCollection.Add(System.String)">Add(string)</h4>
<div class="markdown level1 summary"><p>Adds an entry to the current zip file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Add(string fileName)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Add(fileName As String)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">fileName</span></td>
      <td><p>Name of the file to add to the zip file.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Zip_C1ZipEntryCollection_Add_System_String__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>By default, the directory name is not stored in the zip file. To store a specific
part of the directory name in the zip file, use the overloaded version of the
<b>Add</b> method with a <b>pathLevels</b> parameter.</p>
</div>


<a id="C1_Zip_C1ZipEntryCollection_Add_" data-uid="C1.Zip.C1ZipEntryCollection.Add*"></a>
<h4 id="C1_Zip_C1ZipEntryCollection_Add_System_String___" data-uid="C1.Zip.C1ZipEntryCollection.Add(System.String[])">Add(string[])</h4>
<div class="markdown level1 summary"><p>Adds a list of entries to the current zip file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Add(string[] fileNames)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Add(fileNames As String())</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>[]</td>
      <td><span class="parametername">fileNames</span></td>
      <td><p>Array containing the file names of the entries to be added to the zip file.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Zip_C1ZipEntryCollection_Add_" data-uid="C1.Zip.C1ZipEntryCollection.Add*"></a>
<h4 id="C1_Zip_C1ZipEntryCollection_Add_System_String_System_Int32_" data-uid="C1.Zip.C1ZipEntryCollection.Add(System.String,System.Int32)">Add(string, int)</h4>
<div class="markdown level1 summary"><p>Adds an entry to the current zip file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Add(string fileName, int pathLevels)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Add(fileName As String, pathLevels As Integer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">fileName</span></td>
      <td><p>Name of the file to add to the zip file.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pathLevels</span></td>
      <td><p>The number of path levels to be stored as the entry name.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Zip_C1ZipEntryCollection_Add_System_String_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>By default, path names are not stored in the zip file. For example, adding
the file "c:\temp\samples\readme.txt" to the zip file will create an entry called
"readme.txt".</p>
<p>The <code class="paramref">pathLevels</code> parameter allows you to store one or more levels of the path in the entry name.
For example, adding the file "c:\temp\samples\readme.txt" to the zip file with <code class="paramref">pathLevels</code>=1 
will create an entry called "samples\readme.txt".</p>
</div>


<a id="C1_Zip_C1ZipEntryCollection_Add_" data-uid="C1.Zip.C1ZipEntryCollection.Add*"></a>
<h4 id="C1_Zip_C1ZipEntryCollection_Add_System_String_System_String_" data-uid="C1.Zip.C1ZipEntryCollection.Add(System.String,System.String)">Add(string, string)</h4>
<div class="markdown level1 summary"><p>Adds an entry to the current zip file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Add(string fileName, string entryName)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Add(fileName As String, entryName As String)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">fileName</span></td>
      <td><p>Name of the file to add to the zip file.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">entryName</span></td>
      <td><p>Name of the new entry as stored in the zip file.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Zip_C1ZipEntryCollection_Add_System_String_System_String__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>By default, entries in the zip file have the same name as the original (uncompressed)
file. This method allows you to specify a different name, including a path for example.</p>
</div>


<a id="C1_Zip_C1ZipEntryCollection_Add_" data-uid="C1.Zip.C1ZipEntryCollection.Add*"></a>
<h4 id="C1_Zip_C1ZipEntryCollection_Add_System_String_System_String_System_DateTime_" data-uid="C1.Zip.C1ZipEntryCollection.Add(System.String,System.String,System.DateTime)">Add(string, string, DateTime)</h4>
<div class="markdown level1 summary"><p>Adds an entry to the current zip file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Add(string fileName, string entryName, DateTime dateTime)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Add(fileName As String, entryName As String, dateTime As Date)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">fileName</span></td>
      <td><p>Name of the file to add to the zip file.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">entryName</span></td>
      <td><p>Name of the new entry as stored in the zip file.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.datetime">DateTime</a></td>
      <td><span class="parametername">dateTime</span></td>
      <td><p>The date and time when the file was last modified.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Zip_C1ZipEntryCollection_Add_System_String_System_String_System_DateTime__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>By default, entries in the zip file have the same name as the original (uncompressed)
file. This method allows you to specify a different name, including a path for example.</p>
</div>
</div>
