Actually my previous question got me thinking and I realized that reversing a Dictionary is not trivial. What is the most elegant and readable way to do it?

Same scenario student Many to Many with Classes

original Dicitonary<int, List<int>> where the key is studentId and the Value is a List<int> that contains classId and want to revert to Dictionary<classId, List<studentId>>

Thanks

Update: Actually I just tested Luke and Bruno's solutions and they return the right amount of classed whoever they all have the same student, will update as i go along.

Edit
Report