title: Replace foreach loop with linq
body: <p>I tried to replace code </p>
  
  <pre><code>foreach (var discovery in mpwrapper.parser.Discoveries)
  {
     solution.AddFile("Discoveries", discovery.DisplayStringName + ".mpx", discovery);
  }
  </code></pre>
  
  <p>with the following linq expression</p>
  
  <pre><code>mpwrapper.parser.Discoveries.Select(
                      s =&gt; solution.AddFile("Discoveries", s.DisplayStringName + ".mpx", s));
  </code></pre>
  
  <p>But got an error</p>
  
  <blockquote>
    <p>The type arguments for method
    'System.Linq.Enumerable.Select(System.Collections.Generic.IEnumerable,
    System.Func)' cannot be inferred from the usage. Try
    specifying the type arguments explicitly.</p>
  </blockquote>
  
  <p>How to convert this foreach loop to linq query where I execute a method on each object in my IEnumerable collection?</p>