ByteSize icon indicating copy to clipboard operation
ByteSize copied to clipboard

Add a ByteSpeed type which combines ByteSize & TimeSpan

Open AdamCoulterOz opened this issue 4 years ago • 0 comments

Example:

ByteSize size = ByteSize.FromBytes(1000);
TimeSpan time = TimeSpan.FromSeconds(5);

// use dotnet operator overloading to support basic operations (/, *) for various combinations of:

ByteSpeed speed = (ByteSize) size /  (TimeSpan) time;
TimeSpan   time = (ByteSize) size / (ByteSpeed) speed;
ByteSize   size = (TimeSpan) time * (ByteSpeed) speed;

// ByteSpeed would be a new type

// It would support all the same ToString / Largest operations as ByteSize:
// - LargestWholeNumberValue / given time unit... e.g. second, minute, etc
// - LargestWholeNumberSymbol / given time unit... e.g. second, minute, etc
// with automatic formatting

AdamCoulterOz avatar Apr 03 '21 05:04 AdamCoulterOz