-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add the support of DateOnly and TimeOnly types in TryParse method Utf8Parser class #53768
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @tarekgh, @safern Issue DetailsBackground and MotivationIn .the current version of .NET (5.0.203) Utf8Parser class has only support for With .NET 6 Preview 4 two new types have been introduced
Proposed APIAdditional two overload methods must be added to current Usage ExamplesEg
For
Alternative DesignsRisks
|
Tagging subscribers to this area: @tannergooding Issue DetailsBackground and MotivationIn .the current version of .NET (5.0.203) Utf8Parser class has only support for With .NET 6 Preview 4 two new types have been introduced
Proposed APIAdditional two overload methods must be added to current Usage ExamplesEg
For
Alternative DesignsRisks
|
Tagging subscribers to this area: @tannergooding, @pgovind, @GrabYourPitchforks Issue DetailsBackground and MotivationIn .the current version of .NET (5.0.203) Utf8Parser class has only support for With .NET 6 Preview 4 two new types have been introduced
Proposed APIAdditional two overload methods must be added to current Usage ExamplesEg
For
Alternative DesignsRisks
|
And |
@teo-tsirpanis could you open a separate proposal for |
Rather than adding things on Utf8Parser, the plan forward is to add the UTF-8 parse methods to the relevant types themselves (generally along with implementing For DateOnly and TimeOnly, these API additions are already covered under #81500. It came up in discussion that DateOnly (and maybe TimeOnly) might want more options than the simple parse, like |
Background and Motivation
In .the current version of .NET (5.0.203) Utf8Parser class has only support for
DateTime
.https://docs.microsoft.com/en-us/dotnet/api/system.buffers.text.utf8parser.tryparse?view=net-5.0#System_Buffers_Text_Utf8Parser_TryParse_System_ReadOnlySpan_System_Byte__System_DateTime__System_Int32__System_Char_
With .NET 6 Preview 4 two new types have been introduced
DateOnly
andTimeOnly
. It would be good to have the support of these two types in theTryParse
method ofUtf8Parser
class. In the current version if the date is only passed without time the out variable returns anull
value. I believe there will be legitimate UseCases where only date and time parsing are required explicitly. In order to extract the DateTime now , developers have to fallback toEncoding.UTF8.GetString()
and then useDateTime.TryParse()
method to get the date / time value. This is resource intensive operation and allocations get increased.Eg.
Proposed API
Additional two overload methods must be added to current
Utf8Parser
static class to supportDateOnly
andTimeOnly
types.Usage Examples
Eg
For
DateOnly
typeFor
TimeOnly
typeAlternative Designs
Risks
The text was updated successfully, but these errors were encountered: