I have a Dictionary<string, List<string>>
I want to do a check that all Keys in the dictionary have at least 1 item in its corresponding list
I have a Dictionary<string, List<string>>
I want to do a check that all Keys in the dictionary have at least 1 item in its corresponding list
You can use the Enumerable.All
extension method (part of the LINQ extension methods) for this.
bool allPopulated = yourDictionary.All(p => p.Value != null && p.Value.Count > 0);
Try the following
bool allPopulated = map.All(p => p.Value != null && p.Value.Count > 0);