-
Notifications
You must be signed in to change notification settings - Fork 983
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
Refactor WebBrowserContainer to replace HashTable and Enable Nullability #8226
Refactor WebBrowserContainer to replace HashTable and Enable Nullability #8226
Conversation
src/System.Windows.Forms/src/System/Windows/Forms/WebBrowserContainer.cs
Show resolved
Hide resolved
string name = (ctl.Site is not null) ? ctl.Site.Name : ctl.Name; | ||
return name ?? ""; | ||
} | ||
=> ctl.Site is not null ? ctl.Site.Name ?? string.Empty : ctl.Name; |
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.
ctl.Name
can not be null?
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 just condenses the existing logic. ctl.Name
is only used when ctl.Site
is null. Otherwise ctl.Site.Name
is used and that can be null
, so it returns string.Empy
in that case.
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.
right, earlier, we never return null. now we may be.
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.
I've updated it to check if ctl.Name is null and return string.empty. That should handle it.
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.
LGTM.
Refactored WebBrowserContainer to replace HashTable and Enable Nullability.
Related to #8143
Microsoft Reviewers: Open in CodeFlow