title: C# Linq/Lambda expression: How to select an integer out of a string?
body: <p>I think the best way to explain my question is with a short (generic) linq-to-objects code sample: </p>
  
  <pre><code>IEnumerable&lt;string&gt; ReadLines(string filename)
  {
      string line;
      using (var rdr = new StreamReader(filename))
          while ( (line = rdr.ReadLine()) != null)
             yield return line;
  }
  
  IEnumerable&lt;int&gt; XValuesFromFile(string filename)
  {
      return ReadLines(filename)
                 .Select(l =&gt; l.Substring(3,3))
                 .Where(l =&gt; int.TryParse(l))
                 .Select(i =&gt; int.Parse(i));
  }
  </code></pre>
  
  <p>Notice that this code parses the integer twice.  I know I'm missing an obvious simple way to eliminate one of those calls safely (namely because I've done it before).  I just can't find it right now.  How can I do this?</p>