-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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's TryGetNonEnumeratedCount() should check for IReadOnlyCollection<T> #54764
Comments
Tagging subscribers to this area: @eiriktsarpalis Issue Details
Note: This request was already mentioned in #52775. However, since that issue started as something much bigger, I am concerned that this specific request will be missed.
|
This change would regress F#'s lists. For those that don't know, they are implemented as single-linked lists, and their length is computed in linear time by traversing the entire list. They implement |
This was considered in the implementation PR but ultimately we went with reflecting the checks that exist in |
If we're going to start adding checks for |
@teo-tsirpanis I see your point but I wouldn't consider it a regression. It is assumed that callers of |
That's probably covered by #42254. I'm going to close this issue in favor of that. |
IReadOnlyCollection<T>
can provide a Count without enumerating in:runtime/src/libraries/System.Linq/src/System/Linq/Count.cs
Line 95 in d687544
Note: This request was already mentioned in #52775. However, since that issue started as something much bigger, I am concerned that this specific request will be missed.
The text was updated successfully, but these errors were encountered: