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

Make ByteSize implement the IFormattable interface #50

Closed 0xced closed 3 years ago

0xced commented 3 years ago

This makes Resharper/Rider happy when using string interpolation, for example: $"{byteSize:0.0}" Before implementing the IFormattable interface, Resharper would emit this warning:

Formatting is specified, but interpolated string expression is not IFormattable

Note about compatibility: I'm not 100% sure but I think this change is both source compatible and binary compatible.