Delegate in which the application writes the ZipEntry content for the named entry.
Declaration Syntax
Remarks
When you add an entry and specify a WriteDelegate, via AddEntry(String, WriteDelegate), the application
code provides the logic that writes the entry data directly into the zip file.
Examples
This example shows how to define a WriteDelegate that obtains a DataSet, and then
writes the XML for the DataSet into the zip archive. There's no need to
save the XML to a disk file first.
CopyC#
private void WriteEntry (String filename, Stream output) { DataSet ds1 = ObtainDataSet(); ds1.WriteXml(output); } private void Run() { using (var zip = new ZipFile()) { zip.AddEntry(zipEntryName, WriteEntry); zip.Save(zipFileName); } }
CopyVB.NET
Private Sub WriteEntry (ByVal filename As String, ByVal output As Stream) DataSet ds1 = ObtainDataSet() ds1.WriteXml(stream) End Sub Public Sub Run() Using zip = New ZipFile zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry)) zip.Save(zipFileName) End Using End Sub
See Also