Why does IQueryable.All() return true on an empty collection?

后端 未结 11 1731
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 04:46

So I ran into a situation today where some production code was failing precisely because a method performed exactly as documented in MSDN. Shame on me for not reading the d

11条回答
  •  既然无缘
    2020-12-01 05:39

    Returning true is also logical. You have two statements: "Have a car?" and "Is it red?" If the first statement is false, it doesn't matter what the second statement is, the result is true by modus ponens.

提交回复
热议问题