MoreLINQ icon indicating copy to clipboard operation
MoreLINQ copied to clipboard

ToHashSet has been superseded in .NET Core 2.0+, .NET Framework 4.7.1+

Open b9chris opened this issue 5 years ago • 1 comments

The base .Net framework, starting in .Net Framework 4.7.1, and .Net Core 2.0, includes its own IEnumerable extension method, .ToHashSet(). It should be removed from MoreLinq with a compiler flag for 4.7.1+ and Core 2.0+. Currently, it's easy to end up in a place where you can't compile if you have using statements for both System.Linq and MoreLinq.

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

b9chris avatar Dec 18 '19 13:12 b9chris

Proposed fix.

#739

b9chris avatar Dec 18 '19 15:12 b9chris

@b9chris

It seems as this should be fixed with #945 , but I am still getting an error. Is the error re-introduced, or was it never realeased or am I simply doing something wrong?

image

Rand-Random avatar Dec 06 '23 16:12 Rand-Random

/cc @viceroypenguin @atifaziz

Rand-Random avatar Dec 06 '23 16:12 Rand-Random

Also getting this error, any solutions?

chocobot avatar Mar 11 '24 15:03 chocobot

Looks like MoreLinq is being compiled for netstandard 2.0 and netstandard 2.1, and not for netfx 4.7.2+. As such, when referenced by netfx 4.8, it uses the netstandard 2.0 dll, which does not exclude ToHashSet() (since ns20 does not include that method by default).

MoreLinq deployment will need to be updated to include a netfx 472 dll for proper operation here. As I am not a maintainer on this project, I cannot assist any further.

viceroypenguin avatar Mar 11 '24 15:03 viceroypenguin