I find it really weird that this condition returns true
as a result when there are no items in the IEnumerable collection.
if(Results.All(r => r.Status == ResultStatus.Upload))
Results
is an IEnumerable of objects and I'm basically checking if all its items' statuses are Upload
. My workaround was first checking if the collection has items then check if all items have that status which works fine.
if(Results.Any() && Results.All(r => r.Status == ResultStatus.Upload))
Why does it not validate to false
when there are zero items in the collection?