LINQ: Not Any vs All Don't
问题 Often I want to check if a provided value matches one in a list (e.g. when validating): if (!acceptedValues.Any(v => v == someValue)) { // exception logic } Recently, I\'ve noticed ReSharper asking me to simplify these queries to: if (acceptedValues.All(v => v != someValue)) { // exception logic } Obviously, this is logically identical, perhaps slightly more readable (if you\'ve done a lot of mathematics), my question is: does this result in a performance hit? It feels like it should (i.e.