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
Karthi Keyan
1k
755
237.6k
Error while using ZipArchive.
Mar 28 2017 7:24 AM
Hi,
The below is my code. i got error in marked Lines.
Error :
Severity
Code
Description
Project
File
Line
Error
CS1674
'ZipArchive': type used in a using statement must be implicitly convertible to 'System.IDisposable'
Severity
Code
Description
Project
File
Line
Error
CS0246
The type or namespace name 'ZipArchiveEntry' could not be found (are you missing a using directive or an assembly reference?)
I added the namespaces correctly but i got error. What mistake i did. kindly help me. Thanks in Advance.
using System;
using System.Windows.Forms;
using System.IO;
using System.IO.Compression;
namespace Zip
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnclr_Click(object sender, EventArgs e)
{
txtsource.Text = "";
txtZip.Text = "";
}
private void btnprocess_Click(object sender, EventArgs e)
{
using (FileStream zipToOpen = new FileStream(txtZip.Text, FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
{
ZipArchiveEntry readmeEntry;
DirectoryInfo d = new DirectoryInfo(txtsource.Text);
FileInfo[] Files = d.GetFiles("*");
foreach (FileInfo file in Files)
{
readmeEntry = archive.CreateEntryFromFile(txtsource.Text + "\\" + file.Name,
txtsource.Text + "/" + file.Name);
}
}
}
}
}
}
Reply
Answers (
4
)
Disable zoom and drag from d3 line graph in WPF C#
Expport specific rows from table in MS SQL 12