收到<>信号:
The type arguments for method System.Linq.Enumerable.Select<TSource,TResult>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,int,TResult>) cannot be inferred from the usage. Try specifying the type arguments explicitly.
The first method has no problems using a IEnumerable<T>.Select()
?
Where is the problem with the 2nd method?
private void GetPupilsForSchoolclass()
{
ObservableCollection<PupilViewModel> pupilsOC = new ObservableCollection<PupilViewModel>
( _adminRepo.GetPupilsBySchoolclassId(_selectedSchoolclass.SchoolclassId).Select(p => new PupilViewModel(p, _adminRepo))
);
SelectedSchoolclass.PupilListViewModel = pupilsOC;
}
private void GetDocumentsForPupil()
{
ObservableCollection<Document> documentsOC = new ObservableCollection<Document>();
IEnumerable<Document> documents = _docRepo.GetDocumentsByPupilId(_selectedPupil.Id);
documents.Select(doc => documentsOC.Add(doc));
SelectedPupil.Documents.DocumentList = documentsOC;
}