-
Notifications
You must be signed in to change notification settings - Fork 397
Closed
Description
Following some discussion on #545:
It would be nice to extend the support for IFormattable and ToString.
From the other thread:
So for IFormattable we should make a list:
- "G" = current default implementation
- "A1", "A2"... "An" = abbreviation 1 or 2 or n in the list
- "A" = first abbreviation (equal to "A1")
- "Q" = quantity name (e.g. "Length")
- "V" value using default ToString() for double/decimal/etc.
var length = Length.FromMeters( 3.0 );
var str = length.ToString( "A2" );
For more complicated strings I think you'd want to specify on a more granular level. We don't want to parse all the number format types. For formatting the value as double, etc. you might want to do the following:
var length = Length.FromMeters( 3.0 );
string.Format( "{0,10:E3} [{1:A1}]", length.Value, length );
Metadata
Metadata
Assignees
Labels
No labels