-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
I have a NetStandard20.Extension project at work which is a subset of what Polyfill does and I would like to replace mine with Polyfill and contribute to that instead of the private project.
Is the feature request related to a problem
Polyfill(Lib) is not a drop in package to compile later .NET methods targeting older TargetFrameworks.
The main reason is that the namespace used by Polyfill doesn't match the namespace to use for later frameworks.
E.g. later code does using System.Linq for ToHashSet, but when using Polyfill it requires using Polyfills. Yes the latter could be added as implicit usings, but then we get an IDE0005 about the non-used using System.Linq.
Putting a conditional around that defeats the purpose of Polyfill.
Describe the solution
Put all extension methods in the namespace appropriate for later TargetFrameworks.
IEnumerable<T>.ToHashSet should be in System.Linq
StringBuilder.Appendshould be inSystem.Text`
This approach is already used for other types like: Index, Range and the Nullable attributes.
Describe alternatives considered
Only use implict usings.
Our coding guidelines do not allow this as we prefer to see what is pulled in by a class.
Additional context
To allow phasing out our own NetStandard20.Extensions library and contribute to Polyfill instead.