LINQ Equivalent query
- by GilliVilla
I have a
List<string>
List<string> students;
students.Add("123Rob");
students.Add("234Schulz");
and a
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");
My objective now is to get a List with the values - {Chemistry,Botany} .
In other words, I am trying to get the LINQ equivalent of
select value from [courses]
where [courses].key in
(
select [courses].key from courses,students where [students].id LIKE '%courses.key%'
)
How should the LINQ query be framed?