title: Why StreamReader.EndOfStream property change the BaseStream.Position value
body: <p>I wrote this small program which reads every 5th character from Random.txt 
  In random.txt I have one line of text: ABCDEFGHIJKLMNOPRST. I got the expected result:</p>
  
  <ul>
  <li>Position of A is 0</li>
  <li>Position of F is 5</li>
  <li>Position of K is 10</li>
  <li>Position of P is 15</li>
  </ul>
  
  <p>Here is the code:</p>
  
  <pre><code>static void Main(string[] args)
  {
      StreamReader fp;
      int n;
      fp = new StreamReader("d:\\RANDOM.txt");
      long previousBSposition = fp.BaseStream.Position;
      //In this point BaseStream.Position is 0, as expected
      n = 0;
  
      while (!fp.EndOfStream)
      {
          //After !fp.EndOfStream were executed, BaseStream.Position is changed to 19,
          //so I have to reset it to a previous position :S
          fp.BaseStream.Seek(previousBSposition, SeekOrigin.Begin);
          Console.WriteLine("Position of " + Convert.ToChar(fp.Read()) + " is " + fp.BaseStream.Position);
          n = n + 5;
          fp.DiscardBufferedData();
          fp.BaseStream.Seek(n, SeekOrigin.Begin);
          previousBSposition = fp.BaseStream.Position;
      }
  }
  </code></pre>
  
  <p>My question is, why after line <code>while (!fp.EndOfStream)</code> <code>BaseStream.Position</code> is changed to 19, e.g. end of a <code>BaseStream</code>. I expected, obviously wrong, that <code>BaseStream.Position</code> will stay the same when I call <code>EndOfStream</code> check?</p>
  
  <p>Thanks.</p>