Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public IEqualityComparer<TKey> Comparer
{
get
{
return _comparer;
return (_comparer is NonRandomizedStringEqualityComparer) ? (IEqualityComparer<TKey>)EqualityComparer<string>.Default : _comparer;
Copy link
Copy Markdown
Member

@stephentoub stephentoub Feb 2, 2018

Choose a reason for hiding this comment

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

Shouldn't this be EqualityComparer<TKey> rather than EqualityComparer<string>? Maybe we're just not testing this code path?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, I see why it works ok... TKey must be a string for _comparer to get set to NonRandomizedStringEqualityComparer.

Copy link
Copy Markdown
Member Author

@MarcoRossignoli MarcoRossignoli Feb 2, 2018

Choose a reason for hiding this comment

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

actually compile also with TKey because the constraints are respected and for now we've only optimization with string TKey, i think with EqualityComparer of string the intentions are more clear. Do you agree?

}
}

Expand Down