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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0 defaults to bits (b) whereas all other values defaults to bytes (B)

mintsoft opened this issue · comments

Basically:

Console.WriteLine(ByteSize.FromBytes(0).ToString()); outputs 0b
Console.WriteLine(ByteSize.FromBytes(1).ToString()); outputs 1B

image

This looks really messy when it's used to format a whole table of results etc, it's very rare to actually "see" bits in the wild as most things are usually measured in Bytes. I'm advocating to change the default unit of "0" to be bytes.