Skip to content

Use optimized Dictionary.Remove(key, out value) in .NET Core #2381

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

Merged
merged 4 commits into from
May 16, 2020

Conversation

bahusoid
Copy link
Member

No description provided.

@bahusoid bahusoid changed the title Make use of optimized Dictionary.Remove(key, out value) in .NET Core Use of optimized Dictionary.Remove(key, out value) in .NET Core May 15, 2020
@bahusoid bahusoid changed the title Use of optimized Dictionary.Remove(key, out value) in .NET Core Use optimized Dictionary.Remove(key, out value) in .NET Core May 15, 2020
object tempObject = entitiesByKey[key];
entitiesByKey.Remove(key);
if (!entitiesByKey.Remove(key, out var tempObject))
throw new KeyNotFoundException(key.ToString());
Copy link
Member Author

Choose a reason for hiding this comment

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

Java version doesn't throw here (HashMap.remove is used which returns null instead). Maybe we shouldn't either?

Copy link
Member

Choose a reason for hiding this comment

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

This is actually reported as NH-3478 and NH-1845

@hazzik hazzik merged commit 9006998 into nhibernate:master May 16, 2020
@hazzik hazzik added this to the 5.3 milestone May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants