C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,293 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi All,
I am zipping one folder containing 10 files like abc.txt, pqr.docx,xyz.txt, etc using c#. Now I want to unzip that zip file. But when I Unzip I want to get all files' names in a string with a comma-separated value. How it's possible using c#?
public string GetFilenamesInZip(string sZipFileName)
{
string sFileNames = string.Empty;
using (ZipArchive oArchive = ZipFile.OpenRead(sZipFileName))
{
foreach (var vEntryItem in oArchive.Entries)
{
sFileNames += (vEntryItem + ",");
}
}
if (sFileNames != string.Empty)
sFileNames = sFileNames.Substring(0, sFileNames.Length - 1);
return sFileNames;
}