User Tools

Site Tools


notes:csharp:io

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
notes:csharp:io [2018/10/22]
leszek
notes:csharp:io [2020/01/06] (current)
leszek
Line 145: Line 145:
  
     Console.WriteLine(System.Text.Encoding.UTF8.GetString(data));​     Console.WriteLine(System.Text.Encoding.UTF8.GetString(data));​
 +}
 +</​code>​
 +
 +Example: Decompress an array of bytes and copy it to a file:
 +<code csharp>
 +using (var ms = new MemoryStream(bytes))
 +using (var gs = new GZipStream(ms,​ CompressionMode.Decompress))
 +using (var fs = new FileStream(path,​ FileMode.OpenOrCreate,​ FileAccess.Write))
 +{
 +    gs.CopyTo(fs);​
 } }
 </​code>​ </​code>​
notes/csharp/io.txt ยท Last modified: 2020/01/06 by leszek