Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Improve Dictionary TryGetValue size/perfomance #27195

Merged
merged 8 commits into from
Oct 16, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-Authored-By: Jan Kotas <jkotas@microsoft.com>
  • Loading branch information
benaadams and jkotas committed Oct 16, 2019
commit bbf8fc787305447d520b0e640f5b8a47e3e9c828
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public void Clear()
}
}

public unsafe bool ContainsKey(TKey key)
public bool ContainsKey(TKey key)
=> !Unsafe.IsNullRef(ref FindValue(key));

public bool ContainsValue(TValue value)
Expand Down Expand Up @@ -891,7 +891,7 @@ public bool Remove(TKey key, [MaybeNullWhen(false)] out TValue value)
return false;
}

public unsafe bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
{
ref TValue valRef = ref FindValue(key);
if (!Unsafe.IsNullRef(ref valRef))
Expand Down