Skip to content
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

C# Have TryGetNonEnumeratedCount check for IReadOnlyCollection<T> #99774

Closed
vsfeedback opened this issue Mar 14, 2024 · 2 comments
Closed

C# Have TryGetNonEnumeratedCount check for IReadOnlyCollection<T> #99774

vsfeedback opened this issue Mar 14, 2024 · 2 comments

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


You can have a type that has a Count property and implements IEnumerable but not any of the collection interfaces.
The IReadOnlyCollection interface provides just that.

Currently, Enumerable.TryGetNonEnumeratedCount does not check for IReadOnlyCollection and therefore these types will be fully enumerated when trying to determine the count.


Original Comments

Feedback Bot on 2/27/2024, 09:37 PM:

(private comment, text removed)

Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 14, 2024
@CyrusNajmabadi CyrusNajmabadi transferred this issue from dotnet/roslyn Mar 14, 2024
@stephentoub
Copy link
Member

Duplicate of #42254

@stephentoub stephentoub marked this as a duplicate of #42254 Mar 15, 2024
@stephentoub stephentoub closed this as not planned Won't fix, can't repro, duplicate, stale Mar 15, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Mar 15, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants