I use the following dictionary:
Dictionary<DateTime, List<string>> dictionary
How can I simply check whether one of values -> List
of type string is not empty?
Try using Linq:
Dictionary<DateTime,List<string>> dictionary = ...
bool hasNotEmptyValues = dictionary
.Any(pair => pair.Value != null && pair.Value.Any());
You could use Linq as follows.
var HasNonemptyList = dictionary.Values.Any(iList => iList.Count() > 0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With