title: F# working with while loop
body: <p>I have a datareader and i want to return collection of rows from it, after reading books for like a day i am not able to find out best way to do it in f#. I can do it normal C# way in F# but that is not why i am using f#</p>
  
  <p>Here is what i am trying to achieve</p>
  
  <pre><code>let values =
      while reader.Read() do
          yield reader.GetString(0), reader.GetInt64(1)
  </code></pre>
  
  <p>Above is how i am trying to do</p>
  
  <ul>
  <li>all values get collected into values, which could be dictinary or tuples or any collection</li>
  <li>yield can't be used in while loop but that is what i am trying to do</li>
  </ul>
  
  <p>What could be the best way to achieve this</p>