Get files from a Zip file

suggest change

This example gets a listing of files from the provided zip archive binary data:

public static Dictionary<string, byte[]> GetFiles(byte[] zippedFile) 
{
    using (MemoryStream ms = new MemoryStream(zippedFile))
    using (ZipArchive archive = new ZipArchive(ms, ZipArchiveMode.Read)) 
    {
        return archive.Entries.ToDictionary(x => x.FullName, x => ReadStream(x.Open()));
    }
}

private static byte[] ReadStream(Stream stream) 
{
    using (var ms = new MemoryStream()) 
    {
        stream.CopyTo(ms);
        return ms.ToArray();
    }
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Reading and writing .zip files:
* Get files from a Zip file

Table Of Contents
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
88 Events
92 Structs
98 Reading and writing .zip files
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script