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

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams committed Dec 7, 2017
1 parent 9876cdd commit 4d8b7ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mscorlib/shared/System/Collections/Generic/Dictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public Dictionary(int capacity, IEqualityComparer<TKey> comparer)
this.comparer = comparer;
}

if (typeof(TKey) == typeof(string) && comparer == null)
if (typeof(TKey) == typeof(string) && this.comparer == null)
{
// To start, move off default comparer for string which is randomised
this.comparer = (IEqualityComparer<TKey>)NonRandomizedStringEqualityComparer.Default;
Expand Down Expand Up @@ -283,7 +283,7 @@ public bool ContainsValue(TValue value)
{
for (int i = 0; i < count; i++)
{
if (entries[i].hashCode >= 0 && (default(TValue) == null ? value.Equals(entries[i].value) : EqualityComparer<TValue>.Default.Equals(entries[i].value, value))) return true;
if (entries[i].hashCode >= 0 && EqualityComparer<TValue>.Default.Equals(entries[i].value, value)) return true;
}
}
return false;
Expand Down Expand Up @@ -358,7 +358,7 @@ private int FindEntry(TKey key)
int hashCode = (comparer != null ? comparer.GetHashCode(key) : key.GetHashCode()) & 0x7FFFFFFF;
for (int i = buckets[hashCode % buckets.Length]; i >= 0; i = entries[i].next)
{
if (entries[i].hashCode == hashCode && (comparer != null ? comparer.Equals(entries[i].key, key) : (default(TKey) == null ? key.Equals(entries[i].key) : EqualityComparer<TKey>.Default.Equals(entries[i].key, key)))) return i;
if (entries[i].hashCode == hashCode && (comparer != null ? comparer.Equals(entries[i].key, key) : EqualityComparer<TKey>.Default.Equals(entries[i].key, key))) return i;
}
}
return -1;
Expand Down Expand Up @@ -387,7 +387,7 @@ private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior)

for (int i = buckets[targetBucket]; i >= 0; i = entries[i].next)
{
if (entries[i].hashCode == hashCode && (comparer != null ? comparer.Equals(entries[i].key, key) : (default(TKey) == null ? key.Equals(entries[i].key) : EqualityComparer<TKey>.Default.Equals(entries[i].key, key))))
if (entries[i].hashCode == hashCode && (comparer != null ? comparer.Equals(entries[i].key, key) : EqualityComparer<TKey>.Default.Equals(entries[i].key, key)))
{
if (behavior == InsertionBehavior.OverwriteExisting)
{
Expand Down Expand Up @@ -550,7 +550,7 @@ public bool Remove(TKey key)
{
ref Entry entry = ref entries[i];

if (entry.hashCode == hashCode && (comparer != null ? comparer.Equals(entry.key, key) : (default(TKey) == null ? key.Equals(entry.key) : EqualityComparer<TKey>.Default.Equals(entry.key, key))))
if (entry.hashCode == hashCode && (comparer != null ? comparer.Equals(entry.key, key) : EqualityComparer<TKey>.Default.Equals(entry.key, key)))
{
if (last < 0)
{
Expand Down Expand Up @@ -604,7 +604,7 @@ public bool Remove(TKey key, out TValue value)
{
ref Entry entry = ref entries[i];

if (entry.hashCode == hashCode && (comparer != null ? comparer.Equals(entry.key, key) : (default(TKey) == null ? key.Equals(entry.key) : EqualityComparer<TKey>.Default.Equals(entry.key, key))))
if (entry.hashCode == hashCode && (comparer != null ? comparer.Equals(entry.key, key) : EqualityComparer<TKey>.Default.Equals(entry.key, key)))
{
if (last < 0)
{
Expand Down

0 comments on commit 4d8b7ac

Please sign in to comment.