title: How can I define variables in LINQ?
body: <p><strong>This code:</strong></p>
  
  <pre><code>string[] files = {"test.txt", 
      "test2.txt", 
      "notes.txt", 
      "notes.doc", 
      "data.xml", 
      "test.xml", 
      "test.html", 
      "notes.txt", 
      "test.as"};
  
  files.ToList().ForEach(f =&gt; Console.WriteLine(
          f.Substring(
              f.IndexOf('.') + 1, 
              f.Length - f.IndexOf('.') - 1
              )
      ));
  </code></pre>
  
  <p><strong>produces this list:</strong></p>
  
  <pre><code>txt
  txt
  txt
  doc
  xml
  xml
  html
  txt
  as
  </code></pre>
  
  <p><strong>Is there some way to make <code>f.IndexOf('.')</code> a variable</strong> so that in more complex LINQ queries I have this defined in one place?</p>