title: Why does the IEnumerable<T>.Select() works in 1 of 2 cases ? Can not be inferred from usage
body: <p>I get this <strong>error message:</strong></p>
  
  <pre><code>The type arguments for method 'System.Linq.Enumerable.Select&lt;TSource,TResult&gt;(System.Collections.Generic.IEnumerable&lt;TSource&gt;, System.Func&lt;TSource,int,TResult&gt;)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
  </code></pre>
  
  <p>The first method has no problems using a <code>IEnumerable&lt;T&gt;.Select()</code> ?
  Where is the problem with the 2nd method?</p>
  
  <pre><code>private void GetPupilsForSchoolclass()
  {
     ObservableCollection&lt;PupilViewModel&gt; pupilsOC = new ObservableCollection&lt;PupilViewModel&gt;
     (                            _adminRepo.GetPupilsBySchoolclassId(_selectedSchoolclass.SchoolclassId).Select(p =&gt; new       PupilViewModel(p, _adminRepo))
     );
     SelectedSchoolclass.PupilListViewModel = pupilsOC;
  }
  
  private void GetDocumentsForPupil()
  {
                  ObservableCollection&lt;Document&gt; documentsOC = new ObservableCollection&lt;Document&gt;();
                  IEnumerable&lt;Document&gt; documents = _docRepo.GetDocumentsByPupilId(_selectedPupil.Id);
                  documents.Select(doc =&gt; documentsOC.Add(doc));
                  SelectedPupil.Documents.DocumentList = documentsOC;
  }
  </code></pre>