title: how to get position and length of unzipped gzipstream in c#?
body: <p>i'm trying to read .gz files using binary reader by first unzipping with gzipstream, and then creating a new binary reader with the gzipstream. however, when i try to use the BaseStream.Position and BaseStream.Length of BinaryReader (to know when i'm at the end of my file), i get a NotSupportedException, checking the doc for these fields in GZipStream Class shows:</p>
  
  <p>Length<br>
  This property is not supported and always throws a NotSupportedException.(Overrides Stream.Length.)</p>
  
  <p>Position<br>
  This property is not supported and always throws a NotSupportedException.(Overrides Stream.Position.)</p>
  
  <p>so my question is how can i know when i'm at the end of my file when reading a decompressed GZipStream using BinaryReader? thanks</p>
  
  <p>here is my code:</p>
  
  <pre><code>Stream stream = new MemoryStream(textAsset.bytes);
  GZipStream zippedStream = new GZipStream(stream, CompressionMode.Decompress);
  using (BinaryReader reader = new BinaryReader(zippedStream))
      while(reader.BaseStream.Position != reader.BaseStream.Length)
      {
          //do stuff with BinaryReader
      }
  </code></pre>
  
  <p>the above throws:
  NotSupportedException: Operation is not supported. System.IO.Compression.DeflateStream.get_Position() </p>
  
  <p>due to the BaseStream.Position call in the while()</p>