我已經將其像創建的現有λ-表達:擴展lambda表達式
Expression<Func<Entities.Area, bool>> where = (x => (x.Created > this.Value || (x.Changed != null && x.Changed > this.Value)));
現在,我必須與這一個延伸此表達式:
Expression<Func<Entities.Area, bool>> whereAdd = (x => x.Client.Id == ClientInfo.CurrentClient.Id);
結果應該是這樣的:
Expression<Func<Entities.Area, bool>> where = (x => (x.Created > this.Value || (x.Changed != null && x.Changed > this.Value)) && x.Client.Id == ClientInfo.CurrentClient.Id);
我不能直接更改第一個表達式的創建,因爲它不是我的代碼。
我希望有人能幫助我如何擴展第一個lambda表達式。
爲E從Entities.Area不同類型? –
哦對不起。不,E是Entities.Area(同一類型)。 – BennoDual
http://stackoverflow.com/questions/457316/combining-two-expressions-expressionfunct-bool/457328#457328 – Jude