omar / ByteSize

ByteSize is a utility class that makes byte size representation in code easier by removing ambiguity of the value being represented. ByteSize is to bytes what System.TimeSpan is to time.
MIT License
558 stars 50 forks source link

Different default format when using string interpolation #66

Closed RayCarrot closed 2 years ago

RayCarrot commented 2 years ago

Since the 2.1.0 update using string interpolation to get the string representation of a ByteSize uses a different default format. If the default ToString() method is used then the format is set to "0.##" (which is expected in most scenarios) while using string interpolation (such as "{byteSizeValue}") will default the format to null. Having the format set to null will a lot of times produce very large strings as there's no limit on the number of decimals. My suggestion is to always use "0.##" as the default just how it was prior to version 2.1.0.