-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat: Enable Rule CA1851 #16779
feat: Enable Rule CA1851 #16779
Conversation
You can test this PR using the following package version. |
You can test this PR using the following package version. |
|
||
if (rects.Any()) | ||
if (_presenter.TextLayout.HitTestTextRange(start, length) is IReadOnlyList<Rect> { Count: > 0 } rects) |
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.
That's rather problematic, and I don't think should be accepted. As it makes this control to rely on internal implementation of HitTestTextRange.
HitTestTextRange
can return an enumerable at any point of time, and it would be really hard to find this problem otherwise.
You can test this PR using the following package version. |
var rects = _presenter.TextLayout.HitTestTextRange(start, length); | ||
|
||
if (rects.Any()) | ||
if (_presenter.TextLayout.HitTestTextRange(start, length) is IReadOnlyList<Rect> { Count: > 0 } rects) |
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.
This place wasn't updated
You can test this PR using the following package version. |
What does the pull request do?
CA1851: Possible multiple enumerations of IEnumerable collection
What is the current behavior?
What is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Part of #8944