检查字典中的列表值是否不为空

mac*_*jka 2 c# dictionary list

我使用以下字典:

Dictionary<DateTime, List<string>> dictionary
Run Code Online (Sandbox Code Playgroud)

如何简单地检查值之一 - >List字符串类型是否不为空?

Dmi*_*nko 5

尝试使用Linq:

 Dictionary<DateTime,List<string>> dictionary = ...

 bool hasNotEmptyValues = dictionary
   .Any(pair => pair.Value != null && pair.Value.Any());
Run Code Online (Sandbox Code Playgroud)