This PR is targeted for the v3 release, since it contains a breaking change in how the ByteSize calculates sizes.
Until now, one kilobyte is considered to be 1024 bytes, which is incorrect. The code Console.WriteLine(ByteSize.FromMegabytes(1).Bytes); prints 1048576 instead of 1000000 which was initially very surprising to me. I have had countless discussions over this surprising behavior with my teammates.
This PR fixes the calculation and adds methods to aid in calculating binary instead of decimal powers.
This PR is targeted for the v3 release, since it contains a breaking change in how the
ByteSize
calculates sizes.Until now, one kilobyte is considered to be 1024 bytes, which is incorrect. The code
Console.WriteLine(ByteSize.FromMegabytes(1).Bytes);
prints1048576
instead of1000000
which was initially very surprising to me. I have had countless discussions over this surprising behavior with my teammates.This PR fixes the calculation and adds methods to aid in calculating binary instead of decimal powers.