Dictionary<int, List<Customer>> dictionary = new Dictionary<int, List<Customer>>();
I want to query based on the key and get a List back. Not sure how to structure the LINQ query for that.
Desired Output:
A List<Customer> for a particular key in the Dictionary.
That’s what the Dictionary (as you’ve defined the generic arguments) will do. So,
dictionary[key]will return the list. Note that it will throw an exception if you haven’t initialized it already withdictionary[key] = new List<Customer>();.