Skip to content

DoubleExtensions Class ​

Definition ​

Extenstions for the double datatype

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

Fields ​

NameDescription
BitsInByteNumber of bits in one byte (8).
BitSymbolSymbol representing a bit (lowercase 'b').
BytesInGibiByteNumber of bytes in one gibibyte (1,073,741,824).
BytesInGigaByteNumber of bytes in one gigabyte (1,000,000,000).
BytesInKibiByteNumber of bytes in one kibibyte (1,024).
BytesInKiloByteNumber of bytes in one kilobyte (1,000).
BytesInMebiByteNumber of bytes in one mebibyte (1,048,576).
BytesInMegaByteNumber of bytes in one megabyte (1,000,000).
BytesInPebiByteNumber of bytes in one pebibyte (1,125,899,906,842,624).
BytesInPetaByteNumber of bytes in one petabyte (1,000,000,000,000,000).
BytesInTebiByteNumber of bytes in one tebibyte (1,099,511,627,776).
BytesInTeraByteNumber of bytes in one terabyte (1,000,000,000,000).
ByteSymbolSymbol representing a byte (uppercase 'B').
ExabyteSymbolSymbol for exabyte using the SI decimal system (10^18 bytes).
ExbiByteSymbolSymbol for exbibyte using the IEC binary system (2^60 bytes).
GibiByteSymbolSymbol for gibibyte using the IEC binary system (1,073,741,824 bytes).
GigaByteSymbolSymbol for gigabyte using the SI decimal system (1,000,000,000 bytes).
KibiByteSymbolSymbol for kibibyte using the IEC binary system (1,024 bytes).
KiloByteSymbolSymbol for kilobyte using the SI decimal system (1,000 bytes).
MebiByteSymbolSymbol for mebibyte using the IEC binary system (1,048,576 bytes).
MegaByteSymbolSymbol for megabyte using the SI decimal system (1,000,000 bytes).
PebiByteSymbolSymbol for pebibyte using the IEC binary system (1,125,899,906,842,624 bytes).
PetaByteSymbolSymbol for petabyte using the SI decimal system (1,000,000,000,000,000 bytes).
TebiByteSymbolSymbol for tebibyte using the IEC binary system (1,099,511,627,776 bytes).
TeraByteSymbolSymbol for terabyte using the SI decimal system (1,000,000,000,000 bytes).
YobiByteSymbolSymbol for yobibyte using the IEC binary system (2^80 bytes).
YottaByteSymbolSymbol for yottabyte using the SI decimal system (10^24 bytes).
ZebiByteSymbolSymbol for zebibyte using the IEC binary system (2^70 bytes).
ZettaByteSymbolSymbol for zettabyte using the SI decimal system (10^21 bytes).

Properties ​

NameDescription
UnitSymbolsGets a read-only list of unit symbols (e.g., "kB", "MB", "GiB") corresponding to each ByteSizeUnit enum value.

Methods ​

NameDescription
ByteSizeUnit BinaryUnit(double d)Returns the most appropriate unit for the value, based on thresholds.
ByteSizeUnit DecimalUnit(double d)Returns the most appropriate unit for the value, based on thresholds.
string FormattedBinarySymbol(double d, int decimalPlaces = null, bool separators = null)Returns a formatted string with value and unit symbol.
string FormattedDecimalSymbol(double d, int decimalPlaces = null, bool separators = null)Returns a formatted string with value and unit symbol.
string FormattedUnitSymbol(double d, int decimalPlaces = null, bool separators = null)Returns a formatted string with value and unit symbol.
int Remainder(double input)Returns the digits after the decimal point as an integer. (Example: 5.75 returns 75
string ToFixed(double input, int digits = null)Mimics JavaScript Number.prototype.toFixed() method Primary use case is consistency in expression evaluations shared with front-end
double ToGibiBytes(double d, int decimalPlaces = null)Converts bytes to gibibytes (1 GiB = 1,073,741,824 bytes).
double ToGigaBytes(double d, int decimalPlaces = null)Converts bytes to gigabytes (1 GB = 1,000,000,000 bytes).
double ToKibiBytes(double d, int decimalPlaces = null)Converts bytes to kibibytes (1 KiB = 1024 bytes).
double ToKiloBytes(double d, int decimalPlaces = null)Converts bytes to kilobytes (1 KB = 1000 bytes).
double ToMebiBytes(double d, int decimalPlaces = null)Converts bytes to mebibytes (1 MiB = 1,048,576 bytes).
double ToMegaBytes(double d, int decimalPlaces = null)Converts bytes to megabytes (1 MB = 1,000,000 bytes).
double ToPebiBytes(double d, int decimalPlaces = null)Converts bytes to pebibytes (1 PiB = 1,125,899,906,842,624 bytes).
double ToPetaBytes(double d, int decimalPlaces = null)Converts bytes to petabytes (1 PB = 1,000,000,000,000,000 bytes).
double ToTebiBytes(double d, int decimalPlaces = null)Converts bytes to tebibytes (1 TiB = 1,099,511,627,776 bytes).
double ToTeraBytes(double d, int decimalPlaces = null)Converts bytes to terabytes (1 TB = 1,000,000,000,000 bytes).
double ToUnit(double d, ByteSizeUnit unit)Converts the double value from bytes into the specified unit.
ByteSizeUnit Unit(double d)Returns the most appropriate unit for the value, based on thresholds.
string UnitSymbol(double d)Returns the appropriate unit symbol for the given byte value based on dynamic thresholds.
string UnitSymbolBinary(double d)Returns the appropriate unit symbol for the given byte value based on dynamic thresholds.
string UnitSymbolDecimal(double d)Returns the appropriate unit symbol for the given byte value based on dynamic thresholds.