I was having an error in a business rule, and by investigating, I came up with the following code snippet, which is intended to check if all processes in a list are active:
return processos.All(proc => proc.Ativo)
When debugging, I discovered that% w / o% had zero elements. It's easy to fix, just change the conditional to:
processos
However, the official documentation states that return processos.Any() && processos.All(proc => proc.Ativo)
:
Determines whether all elements of a string meet a condition.
If a list is empty, how can all elements meet a condition? Or do I have a mistake?
I made a reproducible example on Rextester .