我有一個LINQ等效查詢
List<string>
List<string> students;
students.Add("123Rob");
students.Add("234Schulz");
和
Dictionary<string,string>
Dictionary<string, string> courses = new Dictionary<string, string>();
courses .Add("Rob", "Chemistry");
courses .Add("Bob", "Math");
courses .Add("Holly", "Physics");
courses .Add("Schulz", "Botany");
我的目標現在是讓一個列表與價值觀 - {Chemistry,Botany}
。
換句話說,我試圖讓LINQ相當於
select value from [courses]
where [courses].key in
(
select [courses].key from courses,students where [students].id LIKE '%courses.key%'
)
應如何LINQ查詢被陷害?
[枚舉期間的LINQ投射]可能的重複(http://stackoverflow.com/questions/12146296/linq-casting-during-enumeration) –
@LB你錯了..這不是一個重複的,請刪除dv – GilliVilla