Skip to content

Replacing ContainsKey with TryGetValue to avoid duplicate lookups in … #1374

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

robin-karlsson
Copy link

…dictionaries

Copy link
Member

@odinserj odinserj left a comment

Choose a reason for hiding this comment

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

Thanks @robink-teleopti for this clean up! out var definitely simplifies the code. Together with avoiding duplicates we are minimizing the risk to use different property names between calls to ContainsKey and using an indexer, for example due to mistyping. So I'm approving the changes.

@robin-karlsson
Copy link
Author

Yes, actually, I didn't mention it, but I think there was a minor bug in the RecurringJobEntity code before my change; TimeZone = recurringJob.ContainsKey("TimeZoneId") && !String.IsNullOrWhiteSpace("TimeZoneId") where it checked the property name for null or whitespace. Might be good to know though.

odinserj added a commit that referenced this pull request Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants