title: How do I select a collection within a collection using LINQ?
body: <p>I have the following structure.  </p>
  
  <pre><code>public class ToolSettings
  {
    public string Extension { get; set; }
    public ObservableCollection&lt;Tool&gt; Tools { get; set; }
  }
  
  public class Tool
  {
    public string Name { get; set; }
    public string Command { get set; }
  }
  
  // Within app code
  public ObservableCollection&lt;ToolSettings&gt; settings { get; set; }
  </code></pre>
  
  <p>I'd like to grab the Tools collection from the settings collection where the Extension equals a certain string.</p>
  
  <p>Below is my LINQ code, but I'm only getting one item in my collection when I know there's more.  It looks like it produces a collection of a collection, which is why there's only one item.</p>
  
  <pre><code>myListBox.ItemsSource = from i in settings 
                          where i.Extension == myExtension 
                          select i.Tools;
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Thanks for all the good (and quick) answers.  It turns out I only need the first item, but I know that the SelectMany method will come in handy in the future.  So, thanks for all the heads up.  Here is the full solution I used.</p>
  
  <pre><code>myListBox.ItemsSource = (from i in settings 
                           where i.Extension == myExtension 
                           select i.Tools).First();
  </code></pre>