-
Notifications
You must be signed in to change notification settings - Fork 997
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
Add convenience / perf methods to ListViewItem/ControlCollection #10944
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
....Windows.Forms/src/System/Windows/Forms/Controls/ListView/ListView.ListViewItemCollection.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/10.0 #10944 +/- ##
======================================================
+ Coverage 74.22517% 75.09169% +0.86651%
======================================================
Files 3020 3119 +99
Lines 626328 656865 +30537
Branches 46693 51738 +5045
======================================================
+ Hits 464893 493251 +28358
- Misses 158039 160207 +2168
- Partials 3396 3407 +11
Flags with carried forward coverage won't be shown. Click here to find out more. |
…numerable<ListViewItem>`, which necessitates unnecessary array allocations when adding from a collection. It also doesn't implement a generic `IList<T>` which makes typed usage and LINQ usage difficult. This adds that. Also add `IEnumerable<Control>` to `ControlCollection` to address the LINQ scenario. Control has `IList`, but indexed setting throws. I don't want to add `IList<Control>` until we've had time to evaluate the implications of implicitly doing the public steps with the collection that replicate what those setters should be doing. Also tweak `ArrangedElementCollection` so the static empty collection can't be written to. This doesn't fix the ambiguity of `AddRange([..])` with `ListViewItemCollection`, but it does avoid the need for it in some cases.
a3ca32b
to
2bad759
Compare
@JeremyKuhne was there anything blocking merging this? |
Ran out of bandwidth to figure out the best way to implement improvements here that are consistent across our internal collections. I hope to come up with a proposal that API review will be happy with... |
ListViewItemCollection
doesn't have anAddRange
that takes anIEnumerable<ListViewItem>
, which necessitates unnecessary array allocations when adding from a collection.It also doesn't implement a generic
IList<T>
which makes typed usage and LINQ usage difficult. This adds that.Also add
IEnumerable<Control>
toControlCollection
to address the LINQ scenario. Control hasIList
, but indexed setting throws. I don't want to addIList<Control>
until we've had time to evaluate the implications of implicitly doing the public steps with the collection that replicate what those setters should be doing.Also tweak
ArrangedElementCollection
so the static empty collection can't be written to.This doesn't fix the ambiguity of
AddRange([..])
withListViewItemCollection
, but it does avoid the need for it in some cases.Microsoft Reviewers: Open in CodeFlow