Add polyfills for int.TryParse(string, IFormatProvider?, out int) and corresponding methods for other numeric types#58
Merged
Merged
Conversation
…nd corresponding methods for other numeric types
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds polyfills for the simplified TryParse(string, IFormatProvider?, out T) methods that were introduced in .NET 7.0 for all numeric types. These polyfills enable backward compatibility with earlier .NET versions by delegating to the existing TryParse overloads with explicit NumberStyles parameters.
- Implements TryParse polyfills for 13 numeric types (byte, sbyte, short, int, long, ushort, uint, ulong, IntPtr, UIntPtr, float, double, decimal)
- Each polyfill correctly delegates to the existing 4-parameter TryParse overload with appropriate NumberStyles
- Updates documentation to reflect the addition of 13 new members
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| PolyShim/Signatures.md | Updates member count from 184 to 197 and total count from 246 to 259; adds documentation entries for all 13 new TryParse methods |
| PolyShim/Net70/Byte.cs | Adds TryParse polyfill for byte using NumberStyles.Integer |
| PolyShim/Net70/SByte.cs | Adds TryParse polyfill for sbyte using NumberStyles.Integer |
| PolyShim/Net70/Int16.cs | Adds TryParse polyfill for short using NumberStyles.Integer |
| PolyShim/Net70/Int32.cs | Adds TryParse polyfill for int using NumberStyles.Integer |
| PolyShim/Net70/Int64.cs | Adds TryParse polyfill for long using NumberStyles.Integer |
| PolyShim/Net70/Uint16.cs | Adds TryParse polyfill for ushort using NumberStyles.Integer (filename has incorrect casing) |
| PolyShim/Net70/UInt32.cs | Adds TryParse polyfill for uint using NumberStyles.Integer |
| PolyShim/Net70/UInt64.cs | Adds TryParse polyfill for ulong using NumberStyles.Integer |
| PolyShim/Net70/IntPtr.cs | Adds TryParse polyfill for IntPtr that delegates to int or long based on pointer size |
| PolyShim/Net70/UIntPtr.cs | Adds TryParse polyfill for UIntPtr that delegates to uint or ulong based on pointer size |
| PolyShim/Net70/Single.cs | Adds TryParse polyfill for float using NumberStyles.Float | NumberStyles.AllowThousands |
| PolyShim/Net70/Double.cs | Adds TryParse polyfill for double using NumberStyles.Float | NumberStyles.AllowThousands |
| PolyShim/Net70/Decimal.cs | Adds TryParse polyfill for decimal using NumberStyles.Number |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Dec 1, 2025
This was referenced Jan 1, 2026
This was referenced Feb 1, 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.
No description provided.