Class DataPrefixTable
Represents a table of both binary and metric prefixes for units of measure, optimized for data quantity and transmission measurement standards.
public class DataPrefixTable : PrefixTable, IEquatable<IUnit>, IEnumerable<IPrefixUnit>, IEnumerable
- Inheritance
-
DataPrefixTable
- Implements
- Inherited Members
- Extension Methods
Constructors
DataPrefixTable(IUnit)
Initializes a new instance of the DataPrefixTable class.
public DataPrefixTable(IUnit unit)
Parameters
Exceptions
- ArgumentNullException
unitcannot be null.
Fields
DefaultNumberFormat
The default number format used for displaying values related to DataPrefixTable.
public const string DefaultNumberFormat = "#,##0.##"
Field Value
Methods
CreateBitTableFromBits(double, Action<UnitFormatOptions>)
Creates a new instance of DataPrefixTable initialized with value.
public static DataPrefixTable CreateBitTableFromBits(double value, Action<UnitFormatOptions> setup = null)
Parameters
valuedoubleThe double to convert.
setupAction<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- DataPrefixTable
A DataPrefixTable that is equivalent to
valuewith a base unit of Bit.
CreateBitTableFromBytes(double, Action<UnitFormatOptions>)
Creates a new instance of DataPrefixTable initialized with value.
public static DataPrefixTable CreateBitTableFromBytes(double value, Action<UnitFormatOptions> setup = null)
Parameters
valuedoubleThe double to convert.
setupAction<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- DataPrefixTable
A DataPrefixTable that is equivalent to
valuewith a base unit of Bit.
CreateByteTableFromBits(double, Action<UnitFormatOptions>)
Creates a new instance of DataPrefixTable initialized with value.
public static DataPrefixTable CreateByteTableFromBits(double value, Action<UnitFormatOptions> setup = null)
Parameters
valuedoubleThe double to convert.
setupAction<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- DataPrefixTable
A DataPrefixTable that is equivalent to
valuewith a base unit of Byte.
CreateByteTableFromBytes(double, Action<UnitFormatOptions>)
Creates a new instance of DataPrefixTable initialized with value.
public static DataPrefixTable CreateByteTableFromBytes(double value, Action<UnitFormatOptions> setup = null)
Parameters
valuedoubleThe double to convert.
setupAction<UnitFormatOptions>The UnitFormatOptions which may be configured.
Returns
- DataPrefixTable
A DataPrefixTable that is equivalent to
valuewith a base unit of Byte.
GetEnumerator()
Returns an enumerator that iterates through the collection of prefixes.
public override IEnumerator<IPrefixUnit> GetEnumerator()
Returns
- IEnumerator<IPrefixUnit>
An enumerator that can be used to iterate through the collection of prefixes.
ToAggregateString(bool, bool, bool)
Returns an aggregated string of all multiple prefixes of this instance.
public string ToAggregateString(bool includeBinary = true, bool includeDecimal = true, bool includeUnit = true)
Parameters
includeBinaryboolIf set to
true, includes all binary-multiple prefixes in the aggregate.includeDecimalboolIf set to
true, includes all metric-multiple prefixes in the aggregate.includeUnitboolIf set to
true, includes the base unit in the aggregate.
Returns
ToString()
Returns a string that represents the largest multiple prefix of this instance.
public override string ToString()
Returns
Remarks
Evaluates the largest multiple prefix that is greater or equal to 1 and returns it formatted as Binary.
ToString(PrefixStyle)
Returns a string that represents the largest multiple prefix of this instance.
public string ToString(PrefixStyle prefixStyle)
Parameters
prefixStylePrefixStyleThe preferred unit prefix style for formatting.
Returns
Remarks
Evaluates the largest metric-multiple prefix that is greater or equal to 1 and returns it formatted as either Binary or Decimal.