속성 내에서 ObservableCollection
을 필터링 할 수 있습니까? 나는의 변화를 시도했다 다음 속성 getter에서 Linq 필터링
public ObservableCollection<Worker> Workers
{
get { return DataManager.Data.MasterWorkerList.Where(w => w.Known == true); }
set { DataManager.Data.MasterWorkerList = value; }
}
나는 말한다 오류 얻을 :
이
암시 에 'System.Collections.Generic.IEnumerable' '유형 을 변환 할 수 없습니다를 System.Collections.ObjectModel . ObservableCollection '. 명시 적 변환은
나는 타입 캐스팅, 프로그램 컴파일 (이? 당신이 캐스트를 누락) 존재하지만, 나는 InvalidCastException
가 '형 의 개체를 캐스팅 할 수
가 없습니다 말을 얻을 WhereEnumerableIterator
1[AoW.Models.Worker]' to type 'System.Collections.ObjectModel.ObservableCollection
1 [AoW.Models.Worker] '
이 방법으로 필터링 할 수 있습니까? 그렇다면 무엇을 놓치고 있습니까?
가능한 중복 것 (http://stackoverflow.com/이 같이 수행 할 수 있습니다 [ObservableCollection에 할 IEnumerable을 변환하는 방법?] 질문/3559821/how-to-convert-ienumerable-to-observablecollection) –