Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support string and string builder interpolation handler #114

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

skarllot
Copy link
Contributor

@skarllot skarllot commented Dec 9, 2023

The issue or feature being addressed

  • Support string interpolation handler for String and StringBuilder

Details on the issue fix or feature implementation

  • Create DefaultInterpolatedStringHandler for supporting high performance string interpolation
  • Create AppendInterpolatedStringHandler for supporting high performance string interpolation with StringBuilder
  • Create ISpanFormattable to support custom interpolation of an object to a Span
  • Create method extensions for StringBuilder to support appending with AppendInterpolatedStringHandler
  • Optimize Append method extension for StringBuilder

@skarllot
Copy link
Contributor Author

skarllot commented Dec 9, 2023

Maybe StringBuilder extensions are not useful as "method extensions" because the compiler prefer calling string overload instead of with string interpolation.

@SimonCropp
Copy link
Owner

Maybe StringBuilder extensions are not useful as "method extensions" because the compiler prefer calling string overload instead of with string interpolation.

yeah, i think make it not an extension and add some docs that explains why

@skarllot
Copy link
Contributor Author

skarllot commented Dec 9, 2023

Maybe StringBuilder extensions are not useful as "method extensions" because the compiler prefer calling string overload instead of with string interpolation.

yeah, i think make it not an extension and add some docs that explains why

You mean removing this and calling as PolyfillExtensions.Append?

@SimonCropp
Copy link
Owner

yep

@skarllot
Copy link
Contributor Author

Changes made. Additionally, I've optimized interpolation to use TryFormat method extensions.

@skarllot
Copy link
Contributor Author

Rebased to latest commit

@SimonCropp
Copy link
Owner

sorry for the delay. i will deploy this now. should be on nuget in 15

@SimonCropp SimonCropp merged commit f3ce71a into SimonCropp:main Dec 14, 2023
2 checks passed
@SimonCropp SimonCropp added this to the 1.34.0 milestone Dec 14, 2023
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.

2 participants