1
基本上我想傳遞一個謂詞到一個方法,這個方法會導致一個與實體關聯到一個特定的Id的字典結果。但這似乎不起作用..想傳遞一個謂詞到一個方法來得到一個字典結果
public Dictionary<int, Room> GetRooms(Func<KeyValuePair<int, Room>, bool> predicate)
{
return _rooms.Where(predicate).ToDictionary<Room, int>(x => x.Key);
}
任何想法?