theraot / Theraot

Backporting .NET and more: LINQ expressions in .net 2.0 - nuget Theraot.Core available.
MIT License
158 stars 30 forks source link

.ToHashSet() & net472 targeting #114

Closed ig-sinicyn closed 4 years ago

ig-sinicyn commented 4 years ago

.ToHashSet() calls fail for net472 projects

Code

var c = new[] { 1, 2, 3 }.ToHashSet();

Compilation error:

CS0121: The call is ambiguous between the following methods or properties: 
'System.Linq.Enumerable.ToHashSet<TSource>(System.Collections.Generic.IEnumerable<TSource>)' 
and 'System.Linq.EnumerableTheraotExtensions.ToHashSet<TSource>(System.Collections.Generic.IEnumerable<TSource>)'

Shouldn't this extension method be excluded for net472?

NN--- commented 4 years ago

Correct.

Applies to
.NET Core
3.0 2.2 2.1 2.0
.NET Framework
4.8 4.7.2
.NET Standard
2.1

https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.tohashset?view=netframework-4.8

theraot commented 4 years ago

Nuget Version 3.1.1