Add new static extension polyfills using C# 14 syntax#515
Merged
SimonCropp merged 4 commits intoSimonCropp:mainfrom Apr 5, 2026
Merged
Add new static extension polyfills using C# 14 syntax#515SimonCropp merged 4 commits intoSimonCropp:mainfrom
SimonCropp merged 4 commits intoSimonCropp:mainfrom
Conversation
Add polyfills for newer .NET APIs using the C# 14 `extension(Type)` syntax so consumers can call them naturally (e.g. `Directory.CreateTempSubdirectory()` instead of `Polyfill.CreateTempSubdirectory()`). New polyfills: - Stopwatch.GetElapsedTime (NET7+) - Directory.CreateTempSubdirectory (NET7+) - char.IsBetween (NET8+) - TimeSpan.FromDays/FromHours/FromMinutes/FromSeconds/FromMilliseconds/FromMicroseconds integer overloads (NET9+) - string.Concat ReadOnlySpan<string?>/ReadOnlySpan<object?> overloads (NET9+) - Guid.AllBitsSet (NET10+) - Task.WhenAll/WhenAny ReadOnlySpan overloads (NET10+) Refactored: - Polyfill_Directory.cs: wrapped in extension(Directory) block so consumers call Directory.EnumerateFiles() instead of Polyfill.EnumerateFiles() Includes tests, Consume entries, and regenerated Split files.
…lity The extension(Directory) refactor would have broken existing consumers who call Polyfill.EnumerateFiles(...) etc. Reverting to keep the old API surface intact.
Remove duplicate nested #if !NET9_0_OR_GREATER directives that were already covered by the outer guard wrapping the extension(File) block.
Owner
|
@thomhurst LGTM thanks |
This was referenced Apr 6, 2026
This was referenced Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extension(Type)syntax so consumers call APIs naturally on the original types:Stopwatch.GetElapsedTime(NET7+)Directory.CreateTempSubdirectory(NET7+)char.IsBetween(NET8+)TimeSpan.FromDays/FromHours/FromMinutes/FromSeconds/FromMilliseconds/FromMicrosecondsinteger overloads (NET9+)string.ConcatReadOnlySpan<string?>andReadOnlySpan<object?>overloads (NET9+)Guid.AllBitsSet(NET10+)Task.WhenAll/WhenAnyReadOnlySpan<Task>overloads (NET10+)Polyfill_Directory.csto useextension(Directory)— consumers now callDirectory.EnumerateFiles(...)instead ofPolyfill.EnumerateFiles(...)Test plan