Class to hold a ByteSize and a measurement interval, for the purpose of calculating the rate of transfer
public class ByteRate : System.IComparable<Humanizer.ByteRate>, System.IEquatable<Humanizer.ByteRate>, System.IComparableInheritance System.Object → ByteRate
Implements System.IComparable<ByteRate>, System.IEquatable<ByteRate>, System.IComparable
Create a ByteRate with given quantity of bytes across an interval
Class to hold a ByteSize and a measurement interval, for the purpose of calculating the rate of transfer
public ByteRate(Humanizer.ByteSize size, System.TimeSpan interval);size ByteSize
interval System.TimeSpan
Create a ByteRate with given quantity of bytes across an interval
Interval that bytes were transferred in
public System.TimeSpan Interval { get; }Quantity of bytes
public Humanizer.ByteSize Size { get; }Compares this rate with another rate after normalizing both to bytes per second.
public int CompareTo(Humanizer.ByteRate? other);other ByteRate
The rate to compare with.
public int CompareTo(object? obj);obj System.Object
Implements CompareTo(object)
public bool Equals(Humanizer.ByteRate? other);other ByteRate
public override bool Equals(object? obj);obj System.Object
public override int GetHashCode();Calculate rate for the quantity of bytes and interval defined by this instance
public string Humanize(Humanizer.TimeUnit timeUnit=Humanizer.TimeUnit.Second);timeUnit TimeUnit
Unit of time to calculate rate for (defaults is per second)
Calculate rate for the quantity of bytes and interval defined by this instance
public string Humanize(string? format, Humanizer.TimeUnit timeUnit=Humanizer.TimeUnit.Second, System.Globalization.CultureInfo? culture=null);format System.String
The string format to use for the number of bytes
timeUnit TimeUnit
Unit of time to calculate rate for (defaults is per second)
culture System.Globalization.CultureInfo
Culture to use. If null, current thread's culture is used.
Calculates and humanizes this rate using an explicitly selected byte-size unit system.
public string HumanizeWithUnitSystem(Humanizer.ByteSizeUnitSystem unitSystem, string? format=null, Humanizer.TimeUnit timeUnit=Humanizer.TimeUnit.Second, System.Globalization.CultureInfo? culture=null);unitSystem ByteSizeUnitSystem
The byte-size unit system to use.
format System.String
The numeric format and optional byte-size unit token. For DecimalSi and
BinaryIec, SI/IEC-prefixed unit tokens are matched case-insensitively,
while b and B remain case-sensitive; output uses canonical symbol casing.
Legacy preserves established matching behavior.
timeUnit TimeUnit
The time unit to use for the displayed rate.
culture System.Globalization.CultureInfo
The culture used to format the numeric value, byte-size unit, and time-unit symbol.
System.String
The humanized rate.
System.ArgumentOutOfRangeException
unitSystem is not defined.
System.NotSupportedException
timeUnit is not Second, Minute,
or Hour.
System.FormatException
format is invalid, or selects a token not supported by the selected non-legacy system.
Returns the humanized rate using the default format and time unit.
public override string ToString();