docs
docs copied to clipboard
Round Trip Format Example - Outdated code sample or no longer needed?
Type of issue
Code doesn't work
Description
For https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#round-trip-format-specifier-r , It shows a code example for using the round trip format specifier R on a double; however the code example has a comment at the end of the expected output. However; in my testing it has a result like this:
2 questions:
- Is the sample code now incorrect since https://github.com/dotnet/coreclr/pull/22040 and
.ToString()by default is round-trip compatible? Maybe https://github.com/dotnet/docs/commit/adbb5e99aa24f5eb3b8a8a06787585d38b37fd3f just didn't change enough? - When is a necessary use for the round-trip format specifier now (maybe for some data types; but doesn't seem like it is necessary for decimal anymore).
Page URL
https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
Content source URL
https://github.com/dotnet/docs/blob/main/docs/standard/base-types/standard-numeric-format-strings.md
Document Version Independent Id
f23035e0-f271-b48c-f9a9-8582be80b4ad
Article author
@adegeo
Metadata
- ID: 0ae38fce-fc98-9420-6b0b-ceee4e885f2d
- Service: dotnet-fundamentals
Hi @BenjaminMichaelis Thank you for catching this. This is indeed a change between .NET Framework and .NET. A lot of the code here in these fundamental areas were written with .NET Framework. So a note in the code results should be placed that shows the difference between the two.
Thank you for catching this. This is indeed a change between .NET Framework and .NET. A lot of the code here in these fundamental areas were written with .NET Framework. So a note in the code results should be placed that shows the difference between the two.
Out of curiosity, when are format specifiers needed anymore? A lot of the cases seem covered by default, or they are small enough that they really are always round trip compatible. @adegeo
I think a lot of that has to relate to ISO computing standards for information transmission, or business needs related to currency, security, data integrity, etc. If you need a very specific format for whatever reason, you need it. There are so many industries that have all sorts of odd requirements, whether cultural, historical, economical, or whatever. I've worked in a few where I got to see some unique processes related to data transmission and software that I never knew existed, and I've never seen used outside of that one place. 😁