TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
278.7k
How to customize function compress by zip to accept extensio
Jun 8 2020 3:59 AM
I work on c# app doing compress to file using ziparchieve
my dot net version 4.7
CreateZipFile(string fileName, out List
files, extension type xlsx)
I need to pass extension type as optional parameter and if no extension type passed then select all files on folder
if extension type as xlsx passed then compress files that have extension xlsx only
also I need list of string files as out because may be I used again
public
static
void
CreateZipFile(string fileName, List
files)
{
using (ZipArchive zip = ZipFile.Open(fileName, ZipArchiveMode.Update))
{
foreach (
var
file
in
files)
{
if
(!zip.Entries.Any(zipFile => file.Contains(zipFile.FullName)))
{
zip.CreateEntryFromFile(file, Path.GetFileName(file), CompressionLevel.Optimal);
}
}
}
}
Reply
Answers (
0
)
How to check count files inside Res is equal 1 or not ?
Conversions from c# to odbc sql server