Back to Devexpress

ZipItem.Comment Property

officefileapi-devexpress-dot-compression-dot-zipitem-01c6b8be.md

latest3.6 KB
Original Source

ZipItem.Comment Property

Gets or sets a text comment for the zip item.

Namespace : DevExpress.Compression

Assembly : DevExpress.Docs.v25.2.dll

NuGet Package : DevExpress.Document.Processor

Declaration

csharp
public string Comment { get; set; }
vb
Public Property Comment As String

Property Value

TypeDescription
String

A string that is stored in an archive as a comment to the zip item.

|

Remarks

This example adds a text comment to each zip item in the archive that indicates the person who is currently logged on.

View Example

csharp
using DevExpress.Compression;
//...

public void ArchiveWithComment() {
    string path = this.startupPath;
    using (ZipArchive archive = new ZipArchive()) {
        foreach (string file in System.IO.Directory.EnumerateFiles(path)) {
            ZipFileItem zipFI = archive.AddFile(file, "/");
            zipFI.Comment = "Archived by " + Environment.UserName;
        }
        archive.Save("ArchiveWithComment.zip");        
    }
}
vb
Imports DevExpress.Compression

Public Sub ArchiveWithComment()
    Dim path As String = Me.startupPath
    Using archive As New ZipArchive()
        For Each file As String In System.IO.Directory.EnumerateFiles(path)
            Dim zipFI As ZipFileItem = archive.AddFile(file, "/")
            zipFI.Comment = "Archived by " & Environment.UserName
        Next file
        archive.Save("ArchiveWithComment.zip")

    End Using
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Comment property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

zip-compression-and-archive-api-examples/CS/CompressionLibraryExamples/ZipExamples.cs#L146

csharp
ZipFileItem zipFI = archive.AddFile(file, "/");
    zipFI.Comment = "Archived by " + Environment.UserName;
}

zip-compression-and-archive-api-examples/VB/CompressionLibraryExamples/ZipExamples.vb#L151

vb
Dim zipFI As ZipFileItem = archive.AddFile(file, "/")
    zipFI.Comment = "Archived by " & Environment.UserName
Next file

See Also

ZipItem Class

ZipItem Members

DevExpress.Compression Namespace