How can I read Textfiles into string or into array without extract to temporary file before?
If not possible:
is there any c# example to read Textfiles to string from zip archive.
1 Answer, 1 is accepted
0
Tanya
Telerik team
answered on 18 Jan 2018, 05:58 PM
Hello Andreas,
You can achieve that by opening the archive file and reading its entries. When you need to get a string from the entry's stream, you can use the StreamReader class. Here is a simple example:
using (Stream stream = File.Open("test.zip", FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(stream))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
using (StreamReader reader = new StreamReader(entry.Open(), Encoding.UTF8))