c# - Bool list check if every item in list is false -
i have list<bool>
lots of values. efficient way check if every single item in list equals false
?
you can use enumerable.any
find satisfy condition on first match. habib rightly said better use enumerable.all return true empty list of bool.
!lst.any(c=> c == true);
or use enumerable.all
lst.all(c=> c == false);
Comments
Post a Comment