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

Cache expensive lookup that never changes over life of vs. #51943

Merged
merged 1 commit into from
Mar 18, 2021

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

Comment on lines +111 to +114
if (_componentModel_doNotAccessDirectly == null)
_componentModel_doNotAccessDirectly = (IComponentModel)GetService(typeof(SComponentModel));

return _componentModel_doNotAccessDirectly;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (_componentModel_doNotAccessDirectly == null)
_componentModel_doNotAccessDirectly = (IComponentModel)GetService(typeof(SComponentModel));
return _componentModel_doNotAccessDirectly;
return _componentModel_doNotAccessDirectly ??= (IComponentModel)GetService(typeof(SComponentModel));

@CyrusNajmabadi CyrusNajmabadi merged commit 99861b0 into dotnet:main Mar 18, 2021
@ghost ghost added this to the Next milestone Mar 18, 2021
@CyrusNajmabadi CyrusNajmabadi deleted the cacheComponentModel branch March 18, 2021 08:59
@allisonchou allisonchou modified the milestones: Next, 16.10.P2 Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants