Skip to content
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

Ambiguous call for ToHashSet #19

Closed
thomaslevesque opened this issue Oct 8, 2020 · 1 comment · Fixed by #20
Closed

Ambiguous call for ToHashSet #19

thomaslevesque opened this issue Oct 8, 2020 · 1 comment · Fixed by #20
Assignees
Labels

Comments

@thomaslevesque
Copy link
Owner

Linq.Extras has a ToHashSet method, but an identical method was introduced in Linq in the following TFMs:

  • .NET Framework 4.7.2
  • .NET Core 2.0
  • .NET Standard 2.1

This causes an ambiguity when both the System.Linq and Linq.Extras namespaces are imported.

New targets should be added that exclude this method:

  netstandard1.0
  netstandard1.6
  netstandard2.0
+ netstandard2.1
  net45
  net471
+ net472
+ netcoreapp2.0
@thomaslevesque thomaslevesque self-assigned this Oct 8, 2020
@thomaslevesque
Copy link
Owner Author

Interestingly, source.ToHashSet(comparer) is ambiguous, but source.ToHashSet() is not.
This is because Linq actually has two distinct overloads (one with the comparer parameter, one without), whereas Linq.Extras has only one, with an optional comparer parameter.
If the comparer is not specified, the compiler selects the overload without the comparer parameter over the one with an optional comparer parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant