Skip to content

Instantly share code, notes, and snippets.

@LGM-AdrianHum
Last active February 10, 2016 00:49
Show Gist options
  • Save LGM-AdrianHum/6370244afd07e1d2af8a to your computer and use it in GitHub Desktop.
Save LGM-AdrianHum/6370244afd07e1d2af8a to your computer and use it in GitHub Desktop.
Just a snippet that uses System.IO.Compression to copy the data from an embedded files to a string and send it to the console.
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
namespace CheckZipToString
{
internal class Program
{
private static void Main(string[] args)
{
using (var zipStream = new FileStream("some.zip", FileMode.Open))
using (var archive = new ZipArchive(zipStream, ZipArchiveMode.Read)) {
foreach (var entry in archive.Entries) {
using (var stream = entry.Open())
using (var reader = new StreamReader(stream)) {
Console.WriteLine(reader.ReadToEnd());
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment