Skip to content

Conversation

onyxmaster
Copy link

Hi!

Thank you for building this library. Unfortunately, currently it cannot be used with legacy runtimes like .NET Framework. But since this library does not use many "new" .NET-specific features, adding support for .NET Standard 2.0 (and thus supporting .NET Framework 4.6.2 and later) is quite easy.
The proposed changes include the following:

  • add netstandard2.0 TFM along with allowing latest language version so the default language version limiter does not kick in
  • use System.Numerics.BitOperations.LeadingZeroCount(ulong) instead of ulong.LeadingZeroCount(ulong) (same functionality, different names) since it's easier to polyfill + polyfilling it with relatively quick implementation that is only used for .NET Standard 2.0
  • use BitConverter.ToUint64 overload that specifies the target index, because only it is available in .NET Standard 2.0 (there is no performance degradation for the "main" case of .NET 8+9, I ran the benchmarks to verify it)
  • add IEnumerable<>.ToHashSet<> polyfill for .NET Standard 2.0

With these changes, most of the library remains unmodified, the added files are only built for the new TFM and the performance of the existing code is unchanged, but the library can be used by many more developers, who cannot right now target modern versions of .NET for compatibility reasons.

Thanks for taking a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant