I want to compress a file and a directory in C#. I found some solution in Internet but they are so complex and I couldn't run them in my project. Can anybody suggest me a clear and effective solution?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
You could use
GZipStream
in theSystem.IO.Compression
namespace.NET 2.0.
.NET 4
http://msdn.microsoft.com/en-us/library/ms404280.aspx
You can just use ms-dos command line program compact.exe. Look on a parameters compact.exe in cmd and start this process using .NET method Process.Start().
just use following code for compressing a file.
Source code taken from MSDN that is compatible to .Net 2.0 and above