-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LINQ All returns True if the size of the collection is 0. #110433
Comments
Tagging subscribers to this area: @dotnet/area-system-linq |
Thanks, but this is by design. Every item meets the criteria. There just aren't any items. Per the docs: |
@EvgenyMarchuk If you don’t want that behavior, you can use |
I was confused about this. It's very strange to 'say' true if item is empty. |
That question is probably better suited to StackOverflow. |
@EvgenyMarchuk this goes much further than C#: it is a logical "rule". Here is another question related to it from a Math perspective: It may sound strange at first, but it is the most correct way to implement this logical operator. |
Description
I'm getting true for the zero size collection, using LINQ All to check that all items have a value
Reproduction Steps
Expected behavior
False
Actual behavior
True
Regression?
No response
Known Workarounds
No response
Configuration
.net8.0.404
Win10, x64
Other information
If I'm not mistaken, the same is in .net9
The text was updated successfully, but these errors were encountered: